Package org.apache.axis2.classloader
Interface ResourceHandle
- All Known Implementing Classes:
AbstractResourceHandle,DirectoryResourceHandle,JarResourceHandle
public interface ResourceHandle
This is a handle (a connection) to some resource, which may
be a class, native library, text file, image, etc. Handles are returned
by a ResourceFinder. A resource handle allows easy access to the resource data
(using methods
getInputStream() or getBytes()) as well as
access resource metadata, such as attributes, certificates, etc.
As soon as the handle is no longer in use, it should be explicitly
close()d, similarly to I/O streams.- Version:
- $Rev: 704201 $ $Date: 2008-10-14 00:22:25 +0530 (Tue, 14 Oct 2008) $
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closes a connection to the resource indentified by this handle.Return the Attributes of the resource, or null if none.byte[]getBytes()Returns this resource data as an array of bytes.Return the Certificates of the resource, or null if none.Returns the CodeSource URL for the class or resource.intReturns the length of this resource data, or -1 if unknown.Returns and InputStream for reading this resource data.Returns the Manifest of the JAR file from which this resource was loaded, or null if none.getName()Return the name of the resource.getUrl()Returns the URL of the resource.booleanDoes this resource refer to a directory.
-
Method Details
-
getName
String getName()Return the name of the resource. The name is a "/"-separated path name that identifies the resource. -
getUrl
URL getUrl()Returns the URL of the resource. -
isDirectory
boolean isDirectory()Does this resource refer to a directory. Directory resources are commly used as the basis for a URL in client application. A directory resource has 0 bytes for it's content. -
getCodeSourceUrl
URL getCodeSourceUrl()Returns the CodeSource URL for the class or resource. -
getInputStream
Returns and InputStream for reading this resource data.- Throws:
IOException
-
getContentLength
int getContentLength()Returns the length of this resource data, or -1 if unknown. -
getBytes
Returns this resource data as an array of bytes.- Throws:
IOException
-
getManifest
Returns the Manifest of the JAR file from which this resource was loaded, or null if none.- Throws:
IOException
-
getCertificates
Certificate[] getCertificates()Return the Certificates of the resource, or null if none. -
getAttributes
Return the Attributes of the resource, or null if none.- Throws:
IOException
-
close
void close()Closes a connection to the resource indentified by this handle. Releases any I/O objects associated with the handle.
-