com.ca.pki.util
Class GetResource

java.lang.Object
  |
  +--com.ca.pki.util.GetResource

public class GetResource
extends java.lang.Object

This class provides methods for retrieving data or image files from a jar file.


Constructor Summary
GetResource()
          Default constructor.
 
Method Summary
 java.awt.Image getImage(java.lang.String imageFileName)
          This method fisrt look at the current directory to see if the file can be found, if not then the jar file will be examined.
 java.awt.Image getImageWithoutException(java.lang.String imageFileName)
          This method wraps getImage, but supressed the exception, simply returning null if the image is not found.
 java.io.InputStream getInputStream(java.lang.String dataFileName)
          This method fisrt look at the current directory to see if the file can be found, if not then the jar file will be examined.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GetResource

public GetResource()
Default constructor.

Method Detail

getInputStream

public java.io.InputStream getInputStream(java.lang.String dataFileName)
                                   throws java.io.FileNotFoundException
This method fisrt look at the current directory to see if the file can be found, if not then the jar file will be examined.

Parameters:
dataFileName - a String in the form "path\filename.dat". It is the user's job to make sure "path" does not contain ".\" nor "..\".
Returns:
an InputStream connected to the file or the jar.
Throws:
java.io.FileNotFoundException - if file is not in the current dir or in the jar.

getImage

public java.awt.Image getImage(java.lang.String imageFileName)
                        throws java.io.FileNotFoundException
This method fisrt look at the current directory to see if the file can be found, if not then the jar file will be examined.

Parameters:
imageFileName - a String in the form "path\filename.gif". It is the user's job to make sure "path" does not contain ".\" nor "..\".
Returns:
an Image connected to the file or the jar.
Throws:
java.io.FileNotFoundException - if file is not in the current dir or in the jar.

getImageWithoutException

public java.awt.Image getImageWithoutException(java.lang.String imageFileName)
This method wraps getImage, but supressed the exception, simply returning null if the image is not found. An error message is printed to System.err.

Parameters:
imageFileName - a String in the form "path\filename.gif". It is the user's job to make sure "path" does not contain ".\" nor "..\".
Returns:
an Image connected to the file or the jar, or null.