|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.pegacat.vcf.utility.PluginResourceLoader
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 PluginResource.
Field Summary | |
static boolean |
debug
Whether to print out shtuff on the way. |
protected PluginResource[] |
resourceFiles
A list of PluginResource 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 | |
PluginResourceLoader()
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(PluginResource 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. |
PluginResource |
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. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean debug
protected java.util.HashSet unknownResources
protected PluginResource[] resourceFiles
Constructor Detail |
public PluginResourceLoader()
Method Detail |
public void addResource(PluginResource resource)
public java.io.InputStream getInputStream(java.lang.String resourceName) throws java.util.zip.ZipException
public java.awt.Image getImage(java.lang.String imageName, java.awt.Toolkit imageCreator) throws java.util.zip.ZipException
public byte[] getResource(java.lang.String resourceName) throws java.util.zip.ZipException
public PluginResource 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/'
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |