com.deltax.util
Interface ResourceFileFinder

All Known Subinterfaces:
DynamicResourceFileFinder
All Known Implementing Classes:
DynamicJDK12ClassFileFinder, JDK12ClassFileFinder

public interface ResourceFileFinder

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

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

Returns:
a description string

findResourceFile

public 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

public 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. * @param resource the resource name * @return byte[] the bytes of the resource * @throws IOException if a problem arises accessing the resource

Throws:
java.io.IOException

openResource

public 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