org.jboss.virtual.spi
Interface VirtualFileHandler

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbstractJarHandler, AbstractURIHandler, AbstractURLHandler, AbstractVirtualFileHandler, DelegatingHandler, FileHandler, JarEntryHandler, JarHandler, LinkHandler, NestedJarFromStream, NestedJarFromStream.JarEntryContents, NestedJarHandler, NoCopyNestedJarHandler, SynthenticDirEntryHandler

public interface VirtualFileHandler
extends java.io.Serializable

A virtual file handler

Version:
$Revision: 44334 $
Author:
Scott.Stark@jboss.org, Adrian.Brock

Method Summary
 void close()
          Close the resources
 VirtualFileHandler findChild(java.lang.String path)
          Find a child
 java.util.List<VirtualFileHandler> getChildren(boolean ignoreErrors)
          Get the children
 long getLastModified()
          When the file was last modified
 java.lang.String getName()
          Get the simple VF name (X.java)
 VirtualFileHandler getParent()
          Get the parent
 java.lang.String getPathName()
          Get the VFS relative path name (org/jboss/X.java)
 long getSize()
          Get the size
 VFSContext getVFSContext()
          Get the VFSContext this file belongs to
 VirtualFile getVirtualFile()
          Get the virtual file wrapper
 boolean hasBeenModified()
          Returns true if the file has been modified since this method was last called Last modified time is initialized at handler instantiation.
 boolean isHidden()
          Whether it is hidden
 boolean isLeaf()
          Whether it is a simple leaf of the VFS, i.e.
 java.io.InputStream openStream()
          Access the file contents.
 java.net.URI toURI()
          Get the VF URI (file://root/org/jboss/X.java)
 java.net.URL toURL()
          Get the VF URL (file://root/org/jboss/X.java)
 java.net.URL toVfsUrl()
          Get a VFS-based URL
 

Method Detail

getName

java.lang.String getName()
Get the simple VF name (X.java)

Returns:
the simple file name

getPathName

java.lang.String getPathName()
Get the VFS relative path name (org/jboss/X.java)

Returns:
the VFS relative path name

toVfsUrl

java.net.URL toVfsUrl()
                      throws java.net.MalformedURLException,
                             java.net.URISyntaxException
Get a VFS-based URL

Returns:
the url
Throws:
java.net.MalformedURLException
java.net.URISyntaxException

toURI

java.net.URI toURI()
                   throws java.net.URISyntaxException
Get the VF URI (file://root/org/jboss/X.java)

Returns:
the full URI to the VF in the VFS.
Throws:
java.net.URISyntaxException - for an error parsing the URI

toURL

java.net.URL toURL()
                   throws java.net.MalformedURLException,
                          java.net.URISyntaxException
Get the VF URL (file://root/org/jboss/X.java)

Returns:
the full URL to the VF in the VFS.
Throws:
java.net.URISyntaxException - for an error parsing the URI
java.net.MalformedURLException - for any error

getLastModified

long getLastModified()
                     throws java.io.IOException
When the file was last modified

Returns:
the last modified time
Throws:
java.io.IOException - for any problem accessing the virtual file system
java.lang.IllegalStateException - if closed

hasBeenModified

boolean hasBeenModified()
                        throws java.io.IOException
Returns true if the file has been modified since this method was last called Last modified time is initialized at handler instantiation.

Returns:
Throws:
java.io.IOException

getSize

long getSize()
             throws java.io.IOException
Get the size

Returns:
the size
Throws:
java.io.IOException - for any problem accessing the virtual file system
java.lang.IllegalStateException - if closed

isLeaf

boolean isLeaf()
               throws java.io.IOException
Whether it is a simple leaf of the VFS, i.e. whether it can contain other files

Returns:
true if a simple file.
Throws:
java.io.IOException - for any problem accessing the virtual file system
java.lang.IllegalStateException - if the file is closed

isHidden

boolean isHidden()
                 throws java.io.IOException
Whether it is hidden

Returns:
true if hidden.
Throws:
java.io.IOException - for any problem accessing the virtual file system
java.lang.IllegalStateException - if closed

openStream

java.io.InputStream openStream()
                               throws java.io.IOException
Access the file contents.

Returns:
An InputStream for the file contents.
Throws:
java.io.IOException - for any problem accessing the virtual file system
java.lang.IllegalStateException - if closed

getParent

VirtualFileHandler getParent()
                             throws java.io.IOException
Get the parent

Returns:
the parent
Throws:
java.io.IOException - for an error accessing the file system
java.lang.IllegalStateException - if closed

getChildren

java.util.List<VirtualFileHandler> getChildren(boolean ignoreErrors)
                                               throws java.io.IOException
Get the children

Parameters:
ignoreErrors - whether to ignore errors
Returns:
the children
Throws:
java.io.IOException - for an error accessing the file system
java.lang.IllegalStateException - if closed

findChild

VirtualFileHandler findChild(java.lang.String path)
                             throws java.io.IOException
Find a child

Parameters:
path - the path
Returns:
the child
Throws:
java.io.IOException - for an error accessing the file system (or the child doesn't exist)
java.lang.IllegalStateException - if closed

getVFSContext

VFSContext getVFSContext()
Get the VFSContext this file belongs to

Returns:
the context
Throws:
java.lang.IllegalStateException - if closed

getVirtualFile

VirtualFile getVirtualFile()
Get the virtual file wrapper

Returns:
the wrapper
Throws:
java.lang.IllegalStateException - if closed

close

void close()
Close the resources