org.glite.security.voms.utilities
Class Resource

java.lang.Object
  extended byorg.glite.security.voms.utilities.Resource

public final class Resource
extends java.lang.Object

A class for loading resource files.


Constructor Summary
Resource()
           
 
Method Summary
static void addResourceDir(java.lang.String dir)
          Add a source dir to check when searching for a resource.
static java.io.InputStream getResource(java.lang.String resource)
          Find a resource file and return an InputStream for it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Resource

public Resource()
Method Detail

addResourceDir

public static void addResourceDir(java.lang.String dir)
Add a source dir to check when searching for a resource. Multiple directories are searched in reverse order of their addition.


getResource

public static java.io.InputStream getResource(java.lang.String resource)
                                       throws java.io.FileNotFoundException
Find a resource file and return an InputStream for it. It tries the configured resource directories first. If none of them contain the file, then it tries to load the resource via the current class loader.

Parameters:
resource - The name of the resource file.
Returns:
The resource as an InputStream.
Throws:
java.io.FileNotFoundException - if the resource was not found.