Package org.jboss.vfs
Class VFS
- java.lang.Object
-
- org.jboss.vfs.VFS
-
public class VFS extends java.lang.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 VirtualFile
getChild(java.lang.String path)
Find a virtual file.static VirtualFile
getChild(java.net.URI uri)
Find a virtual file.static VirtualFile
getChild(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 recursivelystatic VirtualFile
getRootVirtualFile()
Get the root virtual file for this VFS instance.static java.io.Closeable
mount(VirtualFile mountPoint, FileSystem fileSystem)
Mount a filesystem on a mount point in the VFS.static java.io.Closeable
mountAssembly(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.Closeable
mountReal(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.Closeable
mountTemp(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.Closeable
mountZip(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.Closeable
mountZip(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.Closeable
mountZip(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.Closeable
mountZipExpanded(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.Closeable
mountZipExpanded(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.Closeable
mountZipExpanded(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 void
visit(VirtualFile file, VirtualFileVisitor visitor)
Visit the virtual file systemstatic void
visit(VirtualFileVisitor visitor)
Visit the virtual file system from the root
-
-
-
Method Detail
-
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
-
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 recursivelyVisitorAttributes.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 recursivelyVisitorAttributes.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
-
mountZip
public static java.io.Closeable mountZip(java.io.File 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
- 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.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:
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.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:
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.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:
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.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:
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
- anVirtualFileAssembly
to mount in the VFSmountPoint
- the point at which the filesystem should be mounted- Returns:
- a handle
- Throws:
java.io.IOException
- if an error occurs
-
-