net.larsan.urd.util
Interface Resource

All Known Implementing Classes:
ResourceBase

public interface Resource

A resource is an object which have a location and can be read using an input stream and might be signed. This resource might be read by implementing modules from databases, filesystems, directory services or any other sources as long as it is transparent to the user of this interface.

Version:
Alpha-0.1 / 2002-10-06 21:37
Author:
Lars J. Nilsson

Method Summary
 byte[] getBytes()
          Get a resource as a byte array.
 java.security.cert.Certificate[] getCertificates()
          Get resource Certificates if the resource have been signed.
 java.net.URL getCodeSource()
          Get the code source of a resource.
 java.lang.String getPath()
          Get resource path.
 java.io.InputStream getStream()
          Get a resource as stream.
 java.net.URL getURL()
          Get a resource URL.
 

Method Detail

getPath

public java.lang.String getPath()
Get resource path.

Returns:
The resource path

getStream

public java.io.InputStream getStream()
Get a resource as stream.

Returns:
An input stream from the resource

getBytes

public byte[] getBytes()
Get a resource as a byte array.

Returns:
The resource as a byte array

getURL

public java.net.URL getURL()
Get a resource URL. This should return the complete Java URL for direct reading. This is opposed to getCodeSource() which should return the file/folder source.

Returns:
The resource URL

getCodeSource

public java.net.URL getCodeSource()
Get the code source of a resource. For archives this is the archive file and for ordinary classes this will be the root folder.

Returns:
The resource code source

getCertificates

public java.security.cert.Certificate[] getCertificates()
Get resource Certificates if the resource have been signed. This method should return null if the class/resource is not signed.

Returns:
The certificates for a signed resources, or null if not signed