Interface FileIOSystem

All Superinterfaces:
AutoCloseable
All Known Implementing Classes:
AssetFileSystem

public interface FileIOSystem extends AutoCloseable
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static final class 
    Immutable array of Paths.
    static final class 
    Internal util for holding the current Thread's FileIOSystem instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the root Path of the base FileSystem used by this FileIOSystem.
    default void
    Close the FileIOSystem releasing any held resources.
    default <T> T
    load(AssetPath path, AssetLoader<T> loader)
    Load an asset from a given file Path.
    default AssetPath
    resolve(Path path)
    Convert an asset Path to the actual file Path found within the FileIOSystem.
    Get all root Paths used by this FileIOSystem.
  • Method Details

    • baseRoot

      @Nonnull Path baseRoot()
      Get the root Path of the base FileSystem used by this FileIOSystem.
      Returns:
      The base root Path.
    • roots

      @Nonnull FileIOSystem.PathArray roots()
      Get all root Paths used by this FileIOSystem.
      Returns:
      An array of root Paths.
    • resolve

      @Nonnull default AssetPath resolve(@Nonnull Path path)
      Convert an asset Path to the actual file Path found within the FileIOSystem.
      Parameters:
      path - The asset Path to resolve.
      Returns:
      The resolved Path of the actual file found within the FileIOSystem.
    • load

      @Nonnull default <T> T load(@Nonnull AssetPath path, @Nonnull AssetLoader<T> loader) throws IOException
      Load an asset from a given file Path.
      Parameters:
      path - The asset Path to load the asset from.
      loader - The AssetLoader used to load the asset.
      Returns:
      The loaded asset.
      Throws:
      IOException - if the file does not exist or cannot otherwise be loaded.
    • close

      default void close()
      Close the FileIOSystem releasing any held resources. Implementation should finally call FileIO.closeFileIOSystem(this) to ensure proper cleanup.
      Specified by:
      close in interface AutoCloseable