Package org.jboss.vfs
Class VFS
- java.lang.Object
-
- org.jboss.vfs.VFS
-
public class VFS extends Object
Virtual File System- Version:
- $Revision: 1.1 $
- Author:
- Adrian Brock, Scott.Stark@jboss.org, Ales Justin, David M. Lloyd
-
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static VirtualFilegetChild(String path)Find a virtual file.static VirtualFilegetChild(URI uri)Find a virtual file.static VirtualFilegetChild(URL url)Deprecated.use getChild(URI) insteadstatic List<VirtualFile>getChildren()Get the childrenstatic List<VirtualFile>getChildren(VirtualFileFilter filter)Get the childrenstatic List<VirtualFile>getChildrenRecursively()Get all the children recursivelystatic List<VirtualFile>getChildrenRecursively(VirtualFileFilter filter)Get all the children recursivelystatic VirtualFilegetRootVirtualFile()Get the root virtual file for this VFS instance.static 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
-
-
-
Method Detail
-
mount
public static Closeable mount(VirtualFile mountPoint, FileSystem fileSystem) throws 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:
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(URL url) throws URISyntaxException
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
-
getChild
public static VirtualFile getChild(URI uri)
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
public static VirtualFile getChild(String path)
Find a virtual file.- Parameters:
path- the child path- Returns:
- the child
- Throws:
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 List<VirtualFile> getChildren() throws IOException
Get the children- Returns:
- the children
- Throws:
IOException- for any problem accessing the virtual file system
-
getChildren
public static List<VirtualFile> getChildren(VirtualFileFilter filter) throws IOException
Get the children- Parameters:
filter- to filter the children- Returns:
- the children
- Throws:
IOException- for any problem accessing the virtual file system
-
getChildrenRecursively
public static List<VirtualFile> getChildrenRecursively() throws IOException
Get all the children recursively
This always usesVisitorAttributes.RECURSE- Returns:
- the children
- Throws:
IOException- for any problem accessing the virtual file system
-
getChildrenRecursively
public static List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter) throws IOException
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
public static void visit(VirtualFileVisitor visitor) throws IOException
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
protected static void visit(VirtualFile file, VirtualFileVisitor visitor) throws IOException
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
-
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
public static Closeable mountReal(File realRoot, VirtualFile mountPoint) throws IOException
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
-
-