org.apache.commons.vfs.impl
Class Resource

java.lang.Object
  extended by org.apache.commons.vfs.impl.Resource

 class Resource
extends java.lang.Object

Helper class for VFSClassLoader. This represents a resource loaded with the classloader.

Version:
$Revision: 480428 $ $Date: 2006-11-29 07:15:24 +0100 (Mi, 29 Nov 2006) $
Author:
Brian Olsen
See Also:
VFSClassLoader

Field Summary
private  FileObject packageFolder
           
private  java.lang.String packageName
           
private  FileObject resource
           
private  FileObject root
           
 
Constructor Summary
Resource(java.lang.String name, FileObject root, FileObject resource)
          Creates a new instance.
 
Method Summary
 byte[] getBytes()
          Returns the data for this resource as a byte array.
 java.net.URL getCodeSourceURL()
          Returns the code source as an URL.
 FileObject getFileObject()
          Returns the FileObject of the resource.
 java.lang.String getPackageAttribute(java.util.jar.Attributes.Name attrName)
          Returns an attribute of the package containing the resource.
 FileObject getPackageFolder()
          Returns the folder for the package containing the resource.
 java.lang.String getPackageName()
          Returns the name of the package containing the resource.
 java.net.URL getURL()
          Returns the URL of the resource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

private final FileObject root

resource

private final FileObject resource

packageFolder

private final FileObject packageFolder

packageName

private final java.lang.String packageName
Constructor Detail

Resource

public Resource(java.lang.String name,
                FileObject root,
                FileObject resource)
         throws FileSystemException
Creates a new instance.

Parameters:
root - The code source FileObject.
resource - The resource of the FileObject.
Throws:
FileSystemException
Method Detail

getURL

public java.net.URL getURL()
                    throws FileSystemException
Returns the URL of the resource.

Throws:
FileSystemException

getPackageName

public java.lang.String getPackageName()
Returns the name of the package containing the resource.


getPackageAttribute

public java.lang.String getPackageAttribute(java.util.jar.Attributes.Name attrName)
                                     throws FileSystemException
Returns an attribute of the package containing the resource.

Throws:
FileSystemException

getPackageFolder

public FileObject getPackageFolder()
Returns the folder for the package containing the resource.


getFileObject

public FileObject getFileObject()
Returns the FileObject of the resource.


getCodeSourceURL

public java.net.URL getCodeSourceURL()
                              throws FileSystemException
Returns the code source as an URL.

Throws:
FileSystemException

getBytes

public byte[] getBytes()
                throws java.io.IOException
Returns the data for this resource as a byte array.

Throws:
java.io.IOException