Class VFS

All Implemented Interfaces:
VFSParent, VFSSource

public class VFS extends AbstractVFSSource implements VFSParent
Allows multiple VFS sources to be virtually mounted to form a virtual read-only filesystem. This is very simple and only allows opening of files but doesn't even include enumeration so mostly useful for serving content and such, where the requester already knows what it's looking for.
Since:
1.0
Version:
2022-10-28
  • Constructor Details

    • VFS

      public VFS()
  • Method Details

    • mount

      public VFSSource mount(String mountPoint, KabFile kab)
      Mounts the specified kab at the specified mount point. This is a convenience method that wraps the kab into a KabVFSSource and calls mount().
      Parameters:
      mountPoint - where the source is mounted
      kab - the kab to mount
      Returns:
      the mounted VFSSource
    • mount

      public VFSSource mount(String mountPoint, VFSSource source)
      Mounts the specified source at the specified mount point. It replaces any previous source mounted at the mount point.
      Parameters:
      mountPoint - where the source is mounted
      source - the vfs source to mount
      Returns:
      the supplied source
    • unmount

      public void unmount(VFSSource source)
      Removes the mount point associated with the specified source.
      Parameters:
      source - the source to unmount
    • unmount

      public void unmount(String mountPoint)
      Removes the specified mount point.
      Parameters:
      mountPoint - the mount point to unmount
    • getSource

      public VFSSource getSource(String mountPoint)
      Returns the source mounted to the specified mount point.
      Parameters:
      mountPoint - the mount point to query
      Returns:
      the source or null if not a mount point
    • getInputStream

      public InputStream getInputStream(String path)
      Description copied from interface: VFSSource
      Returns an input stream for the specified path.
      Specified by:
      getInputStream in interface VFSSource
      Parameters:
      path - the requested path
      Returns:
      the input stream or null if not found
    • getBasePath

      public String getBasePath(VFSSource source)
      Returns the base path to the specified VFSSource.
      Specified by:
      getBasePath in interface VFSParent
      Parameters:
      source - the source to return the base path for
      Returns:
      the base path to the source