Package org.jboss.vfs
Class VFS
java.lang.Object
org.jboss.vfs.VFS
Virtual File System
- Version:
- $Revision: 1.1 $
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final class(package private) static final classThe mount representation. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final Setprivate static final ConcurrentMap<VirtualFile, Map<String, VFS.Mount>> private static final VFS.Mountprivate static final VirtualFile -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static VirtualFileprivate static MountHandledoMount(FileSystem fileSystem, VirtualFile mountPoint, Closeable... additionalCloseables) private static <E> Set<E> static VirtualFileFind a virtual file.static VirtualFileFind a virtual file.static VirtualFileDeprecated.use getChild(URI) insteadstatic List<VirtualFile> Get the childrenstatic List<VirtualFile> getChildren(VirtualFileFilter filter) Get the childrenstatic List<VirtualFile> Get all the children recursivelystatic List<VirtualFile> Get all the children recursively(package private) static VFS.MountgetMount(VirtualFile virtualFile) static VirtualFileGet the root virtual file for this VFS instance.getSubmounts(VirtualFile virtualFile) Get all immediate submounts for a path.private static voidinit()Initialize VFS protocol handlers package property.private static booleanstatic Closeablemount(VirtualFile mountPoint, FileSystem fileSystem) Mount a filesystem on a mount point in the VFS.static CloseablemountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) Create and mount an assembly file system, returning a single handle which will unmount and close the filesystem when closed.static CloseablemountReal(File realRoot, VirtualFile mountPoint) Create and mount a real file system, returning a single handle which will unmount and close the filesystem when closed.static CloseablemountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) Create and mount a temporary file system, returning a single handle which will unmount and close the filesystem when closed.static CloseablemountZip(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed.static CloseablemountZip(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed.static CloseablemountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed.static CloseablemountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed.static CloseablemountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed.static CloseablemountZipExpanded(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed.protected static voidvisit(VirtualFile file, VirtualFileVisitor visitor) Visit the virtual file systemstatic voidvisit(VirtualFileVisitor visitor) Visit the virtual file system from the root
-
Field Details
-
mounts
-
rootVirtualFile
-
rootMount
-
EMPTY_REMOVABLE_SET
-
-
Constructor Details
-
VFS
private VFS()Do not allow construction
-
-
Method Details
-
createDefaultRoot
-
init
private static void init()Initialize VFS protocol handlers package property. -
mount
Mount a filesystem on a mount point in the VFS. The mount point is any valid file name, existent or non-existent. If a relative path is given, it will be treated as relative to the VFS root.- Parameters:
mountPoint- the mount pointfileSystem- the file system to mount- Returns:
- a handle which can be used to unmount the filesystem
- Throws:
IOException- if an I/O error occurs, such as a filesystem already being mounted at the given mount point
-
getChild
Deprecated.use getChild(URI) insteadFind a virtual file.- Parameters:
url- the URL whose path component is the child path- Returns:
- the child
- Throws:
IllegalArgumentException- if the path is nullURISyntaxException- for any uri error
-
isWindows
private static boolean isWindows() -
getChild
Find a virtual file.- Parameters:
uri- the URI whose path component is the child path- Returns:
- the child
- Throws:
IllegalArgumentException- if the path is null
-
getChild
Find a virtual file.- Parameters:
path- the child path- Returns:
- the child
- Throws:
IllegalArgumentException- if the path is null
-
getRootVirtualFile
Get the root virtual file for this VFS instance.- Returns:
- the root virtual file
-
getChildren
Get the children- Returns:
- the children
- Throws:
IOException- for any problem accessing the virtual file system
-
getChildren
Get the children- Parameters:
filter- to filter the children- Returns:
- the children
- Throws:
IOException- for any problem accessing the virtual file system
-
getChildrenRecursively
Get all the children recursively
This always usesVisitorAttributes.RECURSE- Returns:
- the children
- Throws:
IOException- for any problem accessing the virtual file system
-
getChildrenRecursively
Get all the children recursively
This always usesVisitorAttributes.RECURSE- Parameters:
filter- to filter the children- Returns:
- the children
- Throws:
IOException- for any problem accessing the virtual file system
-
visit
Visit the virtual file system from the root- Parameters:
visitor- the visitor- Throws:
IOException- for any problem accessing the VFSIllegalArgumentException- if the visitor is null
-
visit
Visit the virtual file system- Parameters:
file- the filevisitor- the visitor- Throws:
IOException- for any problem accessing the VFSIllegalArgumentException- if the file or visitor is null
-
getMount
-
getSubmounts
Get all immediate submounts for a path.- Parameters:
virtualFile- the path- Returns:
- the collection of present mount (simple) names
-
doMount
private static MountHandle doMount(FileSystem fileSystem, VirtualFile mountPoint, Closeable... additionalCloseables) throws IOException - Throws:
IOException
-
mountZip
public static Closeable mountZip(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed.- Parameters:
zipFile- the zip file to mountmountPoint- the point at which the filesystem should be mountedtempFileProvider- the temporary file provider- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountZip
public static Closeable mountZip(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed.- Parameters:
zipData- an input stream containing the zip datazipName- the name of the archivemountPoint- the point at which the filesystem should be mountedtempFileProvider- the temporary file provider- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountZip
public static Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException Create and mount a zip file into the filesystem, returning a single handle which will unmount and close the file system when closed.- Parameters:
zipFile- a zip file in the VFSmountPoint- the point at which the filesystem should be mountedtempFileProvider- the temporary file provider- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountReal
Create and mount a real file system, returning a single handle which will unmount and close the filesystem when closed.- Parameters:
realRoot- the real filesystem rootmountPoint- the point at which the filesystem should be mounted- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountTemp
public static Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException Create and mount a temporary file system, returning a single handle which will unmount and close the filesystem when closed.- Parameters:
mountPoint- the point at which the filesystem should be mountedtempFileProvider- the temporary file provider- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountZipExpanded
public static Closeable mountZipExpanded(File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed.- Parameters:
zipFile- the zip file to mountmountPoint- the point at which the filesystem should be mountedtempFileProvider- the temporary file provider- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountZipExpanded
public static Closeable mountZipExpanded(InputStream zipData, String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed. The given zip data stream is closed.- Parameters:
zipData- an input stream containing the zip datazipName- the name of the archivemountPoint- the point at which the filesystem should be mountedtempFileProvider- the temporary file provider- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountZipExpanded
public static Closeable mountZipExpanded(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws IOException Create and mount an expanded zip file in a temporary file system, returning a single handle which will unmount and close the filesystem when closed. The given zip data stream is closed.- Parameters:
zipFile- a zip file in the VFSmountPoint- the point at which the filesystem should be mountedtempFileProvider- the temporary file provider- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
mountAssembly
public static Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws IOException Create and mount an assembly file system, returning a single handle which will unmount and close the filesystem when closed.- Parameters:
assembly- anVirtualFileAssemblyto mount in the VFSmountPoint- the point at which the filesystem should be mounted- Returns:
- a handle
- Throws:
IOException- if an error occurs
-
emptyRemovableSet
-