net.larsan.urd.util.fileset
Class FileResource

java.lang.Object
  |
  +--net.larsan.urd.util.fileset.ResourceBase
        |
        +--net.larsan.urd.util.fileset.FileResource
All Implemented Interfaces:
Resource

public class FileResource
extends ResourceBase

A single file resource.

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

Field Summary
 
Fields inherited from class net.larsan.urd.util.fileset.ResourceBase
errorHandler, filePath, size, visited
 
Constructor Summary
FileResource(java.io.File root, java.lang.String filePath, java.io.File file)
           
FileResource(java.io.File root, java.lang.String filePath, java.io.File file, long visited, ErrorHandler errorHandler)
           
 
Method Summary
 boolean exists()
          Check if the resource is valid.
 byte[] getBytes()
          Get a byte array from the file.
 java.security.cert.Certificate[] getCertificates()
          Get resource Certificates if the resource have been signed.
 java.net.URL getCodeSource()
          Get code source.
 java.io.InputStream getStream()
          Get a byte stream from the file.
 java.net.URL getURL()
          Get a URL to the resource.
 
Methods inherited from class net.larsan.urd.util.fileset.ResourceBase
equals, getErrorHandler, getFileSize, getPath, getVisitedTime, hashCode, report, setErrorHandler
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileResource

public FileResource(java.io.File root,
                    java.lang.String filePath,
                    java.io.File file,
                    long visited,
                    ErrorHandler errorHandler)

FileResource

public FileResource(java.io.File root,
                    java.lang.String filePath,
                    java.io.File file)
Method Detail

getStream

public java.io.InputStream getStream()
Get a byte stream from the file. Should the resource have been disabled or removed before this method is called it will return null.

Specified by:
getStream in interface Resource
Specified by:
getStream in class ResourceBase
Returns:
A file input stream from the resource, or null if disabled

getBytes

public byte[] getBytes()
Get a byte array from the file. Should the resource have been disabled or removed before this method is called it will return null.

Specified by:
getBytes in interface Resource
Specified by:
getBytes in class ResourceBase
Returns:
A byte array from the resource, or null if disabled

getURL

public java.net.URL getURL()
Get a URL to the resource. Should the resource have been disabled or removed before this method is called it will return null.

Specified by:
getURL in interface Resource
Specified by:
getURL in class ResourceBase
Returns:
The resource URL, or null if disabled

getCodeSource

public java.net.URL getCodeSource()
Get code source.

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.

Specified by:
getCertificates in interface Resource
Specified by:
getCertificates in class ResourceBase
Returns:
The certificates for a signed resources, or null if not signed

exists

public boolean exists()
Check if the resource is valid. This should return false if the underlying file have is removed or unusable.

Specified by:
exists in class ResourceBase
Returns:
True if the resource is still valid