|
JavaView© v3.95.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjvx.rsrc.JarResources
JarResources: JarResources maps all resources included in a Zip or Jar file. Additionaly, it provides a method to extract one as a blob. Can be used both in applications and applets.
| Field Summary | |
boolean |
debugOn
|
| Constructor Summary | |
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. |
|
| Method Summary | |
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. |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public boolean debugOn
| Constructor Detail |
public JarResources(java.lang.String jarFileName)
jarFileName - a jar or zip file
public JarResources(java.lang.String jarFileName,
boolean isApplication)
jarFileName - a jar or zip fileisApplication - | Method Detail |
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.
|
JavaView© v3.95.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||