org.jboss.virtual.spi
Interface VirtualFileHandler

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

public interface VirtualFileHandler
extends Serializable

A virtual file handler

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

Method Summary
 void close()
          Close the resources
 boolean exists()
          Tests whether the underlying implementation file still exists.
 VirtualFileHandler findChild(String path)
          Find a child
 List<VirtualFileHandler> getChildren(boolean ignoreErrors)
          Get the children
 long getLastModified()
          When the file was last modified
 String getName()
          Get the simple VF name (X.java)
 VirtualFileHandler getParent()
          Get the parent
 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.
 InputStream openStream()
          Access the file contents.
 URI toURI()
          Get the VF URI (file://root/org/jboss/X.java)
 URL toURL()
          Get the VF URL (file://root/org/jboss/X.java)
 URL toVfsUrl()
          Get a VFS-based URL
 

Method Detail

getName

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

Returns:
the simple file name

getPathName

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

Returns:
the VFS relative path name

toVfsUrl

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

Returns:
the url
Throws:
MalformedURLException
URISyntaxException

toURI

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

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

toURL

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

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

getLastModified

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

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

hasBeenModified

boolean hasBeenModified()
                        throws 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:
IOException

getSize

long getSize()
             throws IOException
Get the size

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

exists

boolean exists()
               throws IOException
Tests whether the underlying implementation file still exists.

Returns:
true if the file exists, false otherwise.
Throws:
IOException - - thrown on failure to detect existence.

isLeaf

boolean isLeaf()
               throws 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:
IOException - for any problem accessing the virtual file system
IllegalStateException - if the file is closed

isHidden

boolean isHidden()
                 throws IOException
Whether it is hidden

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

openStream

InputStream openStream()
                       throws IOException
Access the file contents.

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

getParent

VirtualFileHandler getParent()
                             throws IOException
Get the parent

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

getChildren

List<VirtualFileHandler> getChildren(boolean ignoreErrors)
                                     throws IOException
Get the children

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

findChild

VirtualFileHandler findChild(String path)
                             throws IOException
Find a child

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

getVFSContext

VFSContext getVFSContext()
Get the VFSContext this file belongs to

Returns:
the context
Throws:
IllegalStateException - if closed

getVirtualFile

VirtualFile getVirtualFile()
Get the virtual file wrapper

Returns:
the wrapper
Throws:
IllegalStateException - if closed

close

void close()
Close the resources



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