|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.ca.commons.cbutil.CBResourceLoader
This Class provides access to a group of zip files. In the case of namespace conflicts between Zip files, the first zip file registered has priority. The zip files are accessed through CBJarResource.
com.ca.od.util.CBJarResource| Field Summary | |
protected static boolean |
debug
Whether to print out shtuff on the way. |
protected CBJarResource[] |
resourceFiles
A list of CBJarResources objects that may be searched for packaged resources. |
protected java.util.HashSet |
unknownResources
a cached list of 'unknown' resources that have been (unsuccessfully) looked up before. |
| Constructor Summary | |
CBResourceLoader()
Constructor - note that that the class is useless until at least one resource file has been registered with it using the addResource() method. |
|
| Method Summary | |
void |
addResource(CBJarResource resource)
Adds a new zip/jar resource file to the list of files to be examined for resources. |
java.awt.Image |
getImage(java.lang.String imageName,
java.awt.Toolkit imageCreator)
Search all registered zip files for a particular Image, and return an awt Image object. |
java.io.InputStream |
getInputStream(java.lang.String resourceName)
Search all registered zip files for a particular file, and return an input stream to that file. |
CBJarResource |
getJarContainingResource(java.lang.String resourceName)
Searches an internal hash, followed by all Jar files, for a particular resource. |
java.lang.String[] |
getPrefixedResources(java.lang.String prefix)
Returns all resources with the given prefix. |
byte[] |
getResource(java.lang.String resourceName)
Search all registered zip files for a particular file, and return the data within that file as a byte array. |
java.lang.String[] |
getWildCardResources(java.lang.String exp)
This is a very PRIMATIVE wildcard matching routine - it allows only ONE wildcard, and that wildcard MUST be a '*' character. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.util.HashSet unknownResources
protected CBJarResource[] resourceFiles
protected static boolean debug
| Constructor Detail |
public CBResourceLoader()
| Method Detail |
public void addResource(CBJarResource resource)
public java.io.InputStream getInputStream(java.lang.String resourceName)
throws java.util.zip.ZipException
java.util.zip.ZipException
public java.awt.Image getImage(java.lang.String imageName,
java.awt.Toolkit imageCreator)
throws java.util.zip.ZipException
java.util.zip.ZipException
public byte[] getResource(java.lang.String resourceName)
throws java.util.zip.ZipException
java.util.zip.ZipExceptionpublic CBJarResource getJarContainingResource(java.lang.String resourceName)
public java.lang.String[] getPrefixedResources(java.lang.String prefix)
prefix - a string to match the start of resources against, e.g. 'icons/'public java.lang.String[] getWildCardResources(java.lang.String exp)
exp - a SIMPLE wildcard expression to match, e.g. 'templates/plain*.html'
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||