Package org.apache.commons.vfs2.impl
Class Resource
- java.lang.Object
-
- org.apache.commons.vfs2.impl.Resource
-
final class Resource extends java.lang.Object
Helper class for VFSClassLoader. This represents a resource loaded with the classloader.- See Also:
VFSClassLoader
-
-
Field Summary
Fields Modifier and Type Field Description private FileObject
packageFolder
private java.lang.String
packageName
private FileObject
resource
private FileObject
root
-
Constructor Summary
Constructors Constructor Description Resource(java.lang.String name, FileObject root, FileObject resource)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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.
-
-
-
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
-
-