classUtils.pack.util
Interface ResourceFinderInterface

All Known Subinterfaces:
DynamicResourceFinderInterfaceInterface
All Known Implementing Classes:
ClassFinder

public interface ResourceFinderInterface

This interface defines services for publicly load resource files.

The JDK12ClassFileFinder class implements this interface emulating the Java 2 system class loader behaviour.

Version:
1.0
Author:
Cristiano Sadun

Method Summary
 java.io.File findResourceFile(java.lang.String resource)
          Find a resource in the filesystem.
 byte[] getResourceBytes(java.lang.String resource)
          Return a byte array with the bytes for the resource, or null if the resource cannot be found.
 java.lang.String getSupportedLoadingScheme()
          Returns the supported loading scheme
 java.io.InputStream openResource(java.lang.String resource)
          Return the stream associated to a resource in the filesystem, or null if such resource cannot be found.
 

Method Detail

getSupportedLoadingScheme

java.lang.String getSupportedLoadingScheme()
Returns the supported loading scheme

Returns:
a description string

findResourceFile

java.io.File findResourceFile(java.lang.String resource)
                              throws java.io.IOException
Find a resource in the filesystem. The returned file either is the resource itself, or a JAR/ZIP file containing the resource.

Parameters:
resource - the resource path
Returns:
a stream to the resource, or null if the resource cannot be found
Throws:
java.io.IOException - if a problem arises accessing the resource

getResourceBytes

byte[] getResourceBytes(java.lang.String resource)
                        throws java.io.IOException
Return a byte array with the bytes for the resource, or null if the resource cannot be found.

Parameters:
resource - the resource name
Returns:
byte[] the bytes of the resource
Throws:
java.io.IOException - if a problem arises accessing the resource

openResource

java.io.InputStream openResource(java.lang.String resource)
                                 throws java.io.IOException
Return the stream associated to a resource in the filesystem, or null if such resource cannot be found.

The returned stream is not buffered.

Parameters:
resource - the resource path
Returns:
a stream to the resource, or null if the resource cannot be found
Throws:
java.io.IOException - if a problem arises accessing the resource