public final class JarResources
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
boolean |
m_bDebugOn
External debug flag.
|
| Constructor and Description |
|---|
JarResources(java.lang.String jarFileName)
creates a JarResources that can only be used in applications.
|
JarResources(java.lang.String jarFileName,
boolean isApplication)
creates a JarResources for an applet or application.
|
| Modifier and Type | Method and Description |
|---|---|
static PsImage |
getImageFromArchive(java.lang.String imageName,
java.lang.String jarArchive)
Get an image from a jar archive.
|
byte[] |
getResource(java.lang.String name)
Extracts a jar resource as a blob.
|
static void |
main(java.lang.String[] args)
Is a test driver.
|
public JarResources(java.lang.String jarFileName)
jarFileName - a jar or zip filepublic JarResources(java.lang.String jarFileName,
boolean isApplication)
jarFileName - a jar or zip fileisApplication - public byte[] getResource(java.lang.String name)
name - a resource name.public static void main(java.lang.String[] args)
...
JarResources JR=new JarResources("GifBundle.jar");
Image image=Toolkit.createImage(JR.getResource("logo.gif");
Image logo=Toolkit.getDefaultToolkit().createImage(
JR.getResources("logo.gif")
);
...
public static PsImage getImageFromArchive(java.lang.String imageName, java.lang.String jarArchive)
Note, the cab-archive built with the automatic tool of VisualJ++ does not have the -p switch enabled which keeps relative path names. Therefore, I call the cabarc tool in the Custom section of this project. Then everything works fine with MS.
Netscape somehow neither reads the image nor the audio from its jar files. I expect that I did something wrong .... At least I kept the current state in which I have added the images and audio to the jar file which requires all to lie in the class/release tree.
imageName - name of image relative to root directory within the archive.jarArchive - name of jar archive including relative path."