Package com.tccc.kos.commons.core.vfs
Class VFS
java.lang.Object
com.tccc.kos.commons.core.vfs.AbstractVFSSource
com.tccc.kos.commons.core.vfs.VFS
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetBasePath
(VFSSource source) Returns the base path to the specified VFSSource.getInputStream
(String path) Returns an input stream for the specified path.Returns the source mounted to the specified mount point.Mounts the specified source at the specified mount point.Mounts the specified kab at the specified mount point.void
Removes the mount point associated with the specified source.void
Removes the specified mount point.Methods inherited from class com.tccc.kos.commons.core.vfs.AbstractVFSSource
getParent, isEnabled, setEnabled, setParent
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tccc.kos.commons.core.vfs.VFSSource
getBasePath, getDetails, getFullPath, onUnmount
-
Constructor Details
-
VFS
public VFS()
-
-
Method Details
-
mount
Mounts the specified kab at the specified mount point. This is a convenience method that wraps the kab into aKabVFSSource
and calls mount().- Parameters:
mountPoint
- where the source is mountedkab
- the kab to mount- Returns:
- the mounted VFSSource
-
mount
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 mountedsource
- the vfs source to mount- Returns:
- the supplied source
-
unmount
Removes the mount point associated with the specified source.- Parameters:
source
- the source to unmount
-
unmount
Removes the specified mount point.- Parameters:
mountPoint
- the mount point to unmount
-
getSource
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
Description copied from interface:VFSSource
Returns an input stream for the specified path.- Specified by:
getInputStream
in interfaceVFSSource
- Parameters:
path
- the requested path- Returns:
- the input stream or null if not found
-
getBasePath
Returns the base path to the specified VFSSource.- Specified by:
getBasePath
in interfaceVFSParent
- Parameters:
source
- the source to return the base path for- Returns:
- the base path to the source
-