JBoss VFS 3.1.0.Final-redhat-2

org.jboss.vfs
Class VFS

java.lang.Object
  extended by 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
static VirtualFile getChild(String path)
          Find a virtual file.
static VirtualFile getChild(URI uri)
          Find a virtual file.
static VirtualFile getChild(URL url)
          Deprecated. use getChild(URI) instead
static List<VirtualFile> getChildren()
          Get the children
static List<VirtualFile> getChildren(VirtualFileFilter filter)
          Get the children
static List<VirtualFile> getChildrenRecursively()
          Get all the children recursively
static List<VirtualFile> getChildrenRecursively(VirtualFileFilter filter)
          Get all the children recursively
static VirtualFile getRootVirtualFile()
          Get the root virtual file for this VFS instance.
static Closeable mount(VirtualFile mountPoint, FileSystem fileSystem)
          Mount a filesystem on a mount point in the VFS.
static 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 Closeable mountReal(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 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 Closeable mountZip(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 Closeable mountZip(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 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 Closeable mountZipExpanded(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 Closeable mountZipExpanded(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 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 system
static void visit(VirtualFileVisitor visitor)
          Visit the virtual file system from the root
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 point
fileSystem - 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) instead

Find a virtual file.

Parameters:
url - the URL whose path component is the child path
Returns:
the child
Throws:
IllegalArgumentException - if the path is null
URISyntaxException - 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 uses VisitorAttributes.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 uses VisitorAttributes.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 VFS
IllegalArgumentException - if the visitor is null

visit

protected static void visit(VirtualFile file,
                            VirtualFileVisitor visitor)
                     throws IOException
Visit the virtual file system

Parameters:
file - the file
visitor - the visitor
Throws:
IOException - for any problem accessing the VFS
IllegalArgumentException - 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 mount
mountPoint - the point at which the filesystem should be mounted
tempFileProvider - 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 data
zipName - the name of the archive
mountPoint - the point at which the filesystem should be mounted
tempFileProvider - 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 VFS
mountPoint - the point at which the filesystem should be mounted
tempFileProvider - 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 root
mountPoint - 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 mounted
tempFileProvider - 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 mount
mountPoint - the point at which the filesystem should be mounted
tempFileProvider - 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 data
zipName - the name of the archive
mountPoint - the point at which the filesystem should be mounted
tempFileProvider - 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 VFS
mountPoint - the point at which the filesystem should be mounted
tempFileProvider - 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 - an VirtualFileAssembly to mount in the VFS
mountPoint - the point at which the filesystem should be mounted
Returns:
a handle
Throws:
IOException - if an error occurs

JBoss VFS 3.1.0.Final-redhat-2

Copyright © 2012 JBoss, A division of Red Hat, Inc. All Rights Reserved.