org.jboss.virtual.plugins.context
Class AbstractURLHandler

java.lang.Object
  extended by org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
      extended by org.jboss.virtual.plugins.context.AbstractURLHandler
All Implemented Interfaces:
java.io.Serializable, VirtualFileHandler
Direct Known Subclasses:
AbstractJarHandler, FileHandler, JarEntryHandler, LinkHandler, SynthenticDirEntryHandler

public abstract class AbstractURLHandler
extends AbstractVirtualFileHandler

URLHandler.

Version:
$Revision: 1.1 $
Author:
Adrian Brock
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
cachedLastModified, log, vfsUrl
 
Constructor Summary
AbstractURLHandler(VFSContext context, VirtualFileHandler parent, java.net.URL url, java.lang.String name)
          Create a newURLHandler.
 
Method Summary
 long getLastModified()
          When the file was last modified
 long getSize()
          Get the size
 java.net.URL getURL()
          Get the url
protected  void initCacheLastModified()
           
 boolean isHidden()
          Whether it is hidden
 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)
 
Methods inherited from class org.jboss.virtual.plugins.context.AbstractVirtualFileHandler
checkClosed, close, doClose, equals, getName, getParent, getPathName, getVFSContext, getVirtualFile, hasBeenModified, hashCode, simpleFindChild, structuredFindChild, toString, toVfsUrl
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jboss.virtual.spi.VirtualFileHandler
findChild, getChildren, isLeaf
 

Constructor Detail

AbstractURLHandler

public AbstractURLHandler(VFSContext context,
                          VirtualFileHandler parent,
                          java.net.URL url,
                          java.lang.String name)
Create a newURLHandler.

Parameters:
context - the context
parent - the parent
url - the url
name - the name
Throws:
java.lang.IllegalArgumentException - for a null context, vfsPath or url
Method Detail

initCacheLastModified

protected void initCacheLastModified()

getURL

public java.net.URL getURL()
Get the url

Returns:
the url

toURL

public java.net.URL toURL()
                   throws java.net.MalformedURLException,
                          java.net.URISyntaxException
Description copied from interface: VirtualFileHandler
Get the VF URL (file://root/org/jboss/X.java)

Specified by:
toURL in interface VirtualFileHandler
Overrides:
toURL in class AbstractVirtualFileHandler
Returns:
the full URL to the VF in the VFS.
Throws:
java.net.MalformedURLException - for any error
java.net.URISyntaxException - for an error parsing the URI

getLastModified

public long getLastModified()
                     throws java.io.IOException
Description copied from interface: VirtualFileHandler
When the file was last modified

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

getSize

public long getSize()
             throws java.io.IOException
Description copied from interface: VirtualFileHandler
Get the size

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

isHidden

public boolean isHidden()
                 throws java.io.IOException
Description copied from interface: VirtualFileHandler
Whether it is hidden

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

openStream

public java.io.InputStream openStream()
                               throws java.io.IOException
Description copied from interface: VirtualFileHandler
Access the file contents.

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

toURI

public java.net.URI toURI()
                   throws java.net.URISyntaxException
Description copied from interface: VirtualFileHandler
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