Package org.jboss.vfs

Class VFS

    • 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) instead
      static java.util.List<VirtualFile> getChildren()
      Get the children
      static java.util.List<VirtualFile> getChildren​(VirtualFileFilter filter)
      Get the children
      static java.util.List<VirtualFile> getChildrenRecursively()
      Get all the children recursively
      static java.util.List<VirtualFile> getChildrenRecursively​(VirtualFileFilter filter)
      Get all the children recursively
      static 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 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 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 point
        fileSystem - 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) instead
        Find 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 null
        java.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 recursively

        This always uses VisitorAttributes.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 uses VisitorAttributes.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 VFS
        java.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 file
        visitor - the visitor
        Throws:
        java.io.IOException - for any problem accessing the VFS
        java.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 mount
        mountPoint - the point at which the filesystem should be mounted
        tempFileProvider - 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 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:
        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 VFS
        mountPoint - the point at which the filesystem should be mounted
        tempFileProvider - 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 root
        mountPoint - 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 mounted
        tempFileProvider - 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 mount
        mountPoint - the point at which the filesystem should be mounted
        tempFileProvider - 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 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:
        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 VFS
        mountPoint - the point at which the filesystem should be mounted
        tempFileProvider - 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 - an VirtualFileAssembly to mount in the VFS
        mountPoint - the point at which the filesystem should be mounted
        Returns:
        a handle
        Throws:
        java.io.IOException - if an error occurs