Package org.jboss.vfs
Class VFS
- java.lang.Object
-
- org.jboss.vfs.VFS
-
public class VFS extends java.lang.ObjectVirtual File System- Version:
- $Revision: 1.1 $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classVFS.EmptyRemovableSet<E>private static classVFS.LeakDescriptor(package private) static classVFS.MountThe mount representation.
-
Field Summary
Fields Modifier and Type Field Description private static java.util.SetEMPTY_REMOVABLE_SETprivate static java.util.concurrent.ConcurrentMap<VirtualFile,java.util.Map<java.lang.String,VFS.Mount>>mountsprivate static VFS.MountrootMountprivate static VirtualFilerootVirtualFile
-
Constructor Summary
Constructors Modifier Constructor Description privateVFS()Do not allow construction
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private static VirtualFilecreateDefaultRoot()private static MountHandledoMount(FileSystem fileSystem, VirtualFile mountPoint, java.io.Closeable... additionalCloseables)private static <E> java.util.Set<E>emptyRemovableSet()static VirtualFilegetChild(java.lang.String path)Find a virtual file.static VirtualFilegetChild(java.net.URI uri)Find a virtual file.static VirtualFilegetChild(java.net.URL url)Deprecated.use getChild(URI) insteadstatic java.util.List<VirtualFile>getChildren()Get the childrenstatic java.util.List<VirtualFile>getChildren(VirtualFileFilter filter)Get the childrenstatic java.util.List<VirtualFile>getChildrenRecursively()Get all the children recursivelystatic java.util.List<VirtualFile>getChildrenRecursively(VirtualFileFilter filter)Get all the children recursively(package private) static VFS.MountgetMount(VirtualFile virtualFile)static VirtualFilegetRootVirtualFile()Get the root virtual file for this VFS instance.(package private) static java.util.Set<java.lang.String>getSubmounts(VirtualFile virtualFile)Get all immediate submounts for a path.private static voidinit()Initialize VFS protocol handlers package property.private static booleanisWindows()static java.io.Closeablemount(VirtualFile mountPoint, FileSystem fileSystem)Mount a filesystem on a mount point in the VFS.static java.io.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 java.io.CloseablemountReal(java.io.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 java.io.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 java.io.CloseablemountZip(java.io.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 java.io.CloseablemountZip(java.io.InputStream zipData, java.lang.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 java.io.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 java.io.CloseablemountZipExpanded(java.io.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 java.io.CloseablemountZipExpanded(java.io.InputStream zipData, java.lang.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 java.io.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 Detail
-
mounts
private static final java.util.concurrent.ConcurrentMap<VirtualFile,java.util.Map<java.lang.String,VFS.Mount>> mounts
-
rootVirtualFile
private static final VirtualFile rootVirtualFile
-
rootMount
private static final VFS.Mount rootMount
-
EMPTY_REMOVABLE_SET
private static final java.util.Set EMPTY_REMOVABLE_SET
-
-
Method Detail
-
createDefaultRoot
private static VirtualFile createDefaultRoot()
-
init
private static void init()
Initialize VFS protocol handlers package property.
-
mount
public static java.io.Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws java.io.IOException
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:
java.io.IOException- if an I/O error occurs, such as a filesystem already being mounted at the given mount point
-
getChild
@Deprecated public static VirtualFile getChild(java.net.URL url) throws java.net.URISyntaxException
Deprecated.use getChild(URI) insteadFind a virtual file.- Parameters:
url- the URL whose path component is the child path- Returns:
- the child
- Throws:
java.lang.IllegalArgumentException- if the path is nulljava.net.URISyntaxException- for any uri error
-
isWindows
private static boolean isWindows()
-
getChild
public static VirtualFile getChild(java.net.URI uri)
Find a virtual file.- Parameters:
uri- the URI whose path component is the child path- Returns:
- the child
- Throws:
java.lang.IllegalArgumentException- if the path is null
-
getChild
public static VirtualFile getChild(java.lang.String path)
Find a virtual file.- Parameters:
path- the child path- Returns:
- the child
- Throws:
java.lang.IllegalArgumentException- if the path is null
-
getRootVirtualFile
public static VirtualFile getRootVirtualFile()
Get the root virtual file for this VFS instance.- Returns:
- the root virtual file
-
getChildren
public static java.util.List<VirtualFile> getChildren() throws java.io.IOException
Get the children- Returns:
- the children
- Throws:
java.io.IOException- for any problem accessing the virtual file system
-
getChildren
public static java.util.List<VirtualFile> getChildren(VirtualFileFilter filter) throws java.io.IOException
Get the children- Parameters:
filter- to filter the children- Returns:
- the children
- Throws:
java.io.IOException- for any problem accessing the virtual file system
-
getChildrenRecursively
public static java.util.List<VirtualFile> getChildrenRecursively() throws java.io.IOException
Get all the children recursively
This always usesVisitorAttributes.RECURSE- Returns:
- the children
- Throws:
java.io.IOException- for any problem accessing the virtual file system
-
getChildrenRecursively
public static java.util.List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws java.io.IOException
Get all the children recursively
This always usesVisitorAttributes.RECURSE- Parameters:
filter- to filter the children- Returns:
- the children
- Throws:
java.io.IOException- for any problem accessing the virtual file system
-
visit
public static void visit(VirtualFileVisitor visitor) throws java.io.IOException
Visit the virtual file system from the root- Parameters:
visitor- the visitor- Throws:
java.io.IOException- for any problem accessing the VFSjava.lang.IllegalArgumentException- if the visitor is null
-
visit
protected static void visit(VirtualFile file, VirtualFileVisitor visitor) throws java.io.IOException
Visit the virtual file system- Parameters:
file- the filevisitor- the visitor- Throws:
java.io.IOException- for any problem accessing the VFSjava.lang.IllegalArgumentException- if the file or visitor is null
-
getMount
static VFS.Mount getMount(VirtualFile virtualFile)
-
getSubmounts
static java.util.Set<java.lang.String> getSubmounts(VirtualFile virtualFile)
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, java.io.Closeable... additionalCloseables) throws java.io.IOException
- Throws:
java.io.IOException
-
mountZip
public static java.io.Closeable mountZip(java.io.File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws java.io.IOExceptionCreate 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:
java.io.IOException- if an error occurs
-
mountZip
public static java.io.Closeable mountZip(java.io.InputStream zipData, java.lang.String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws java.io.IOExceptionCreate 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:
java.io.IOException- if an error occurs
-
mountZip
public static java.io.Closeable mountZip(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws java.io.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:
java.io.IOException- if an error occurs
-
mountReal
public static java.io.Closeable mountReal(java.io.File realRoot, VirtualFile mountPoint) throws java.io.IOExceptionCreate 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:
java.io.IOException- if an error occurs
-
mountTemp
public static java.io.Closeable mountTemp(VirtualFile mountPoint, TempFileProvider tempFileProvider) throws java.io.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:
java.io.IOException- if an error occurs
-
mountZipExpanded
public static java.io.Closeable mountZipExpanded(java.io.File zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws java.io.IOExceptionCreate 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:
java.io.IOException- if an error occurs
-
mountZipExpanded
public static java.io.Closeable mountZipExpanded(java.io.InputStream zipData, java.lang.String zipName, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws java.io.IOExceptionCreate 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:
java.io.IOException- if an error occurs
-
mountZipExpanded
public static java.io.Closeable mountZipExpanded(VirtualFile zipFile, VirtualFile mountPoint, TempFileProvider tempFileProvider) throws java.io.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:
java.io.IOException- if an error occurs
-
mountAssembly
public static java.io.Closeable mountAssembly(VirtualFileAssembly assembly, VirtualFile mountPoint) throws java.io.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:
java.io.IOException- if an error occurs
-
emptyRemovableSet
private static <E> java.util.Set<E> emptyRemovableSet()
-
-