public final class JarResources
extends Object
| Modifier and Type | Field and Description |
|---|---|
private boolean |
debugOn |
private Hashtable |
htJarContents |
private Hashtable |
htSizes |
private String |
jarFileName |
| Constructor and Description |
|---|
JarResources(String jarFileName)
creates a JarResources.
|
| Modifier and Type | Method and Description |
|---|---|
private String |
dumpZipEntry(ZipEntry ze)
Dumps a zip entry into a string.
|
byte[] |
getResource(String name)
Extracts a jar resource as a blob.
|
private void |
init()
initializes internal hash tables with Jar file resources.
|
static void |
main(String[] args)
Is a test driver.
|
private boolean debugOn
private Hashtable htSizes
private Hashtable htJarContents
private String jarFileName
public JarResources(String jarFileName)
throws IOException,
FileNotFoundException
jarFileName - a jar or zip fileIOExceptionFileNotFoundExceptionpublic byte[] getResource(String name)
name - a resource name.private void init()
throws IOException,
FileNotFoundException
IOExceptionFileNotFoundExceptionprivate String dumpZipEntry(ZipEntry ze)
ze - a ZipEntrypublic static void main(String[] args)
throws IOException
...
JarResources JR=new JarResources("GifBundle.jar");
Image image=Toolkit.createImage(JR.getResource("logo.gif");
Image logo=Toolkit.getDefaultToolkit().createImage(
JR.getResources("logo.gif")
);
...
IOException