jvx.rsrc

## Class JarResources

- java.lang.Object
- - jvx.rsrc.JarResources

-     public final class JarResources
      extends java.lang.Object

  JarResources: JarResources maps all resources included in a Zip or Jar file. Additionally, it provides a method to extract one as a blob. Can be used both in applications and applets.
  Version:
    14.01.07, 1.60 revised (kp) Variable renamed to code guidelines.
    26.01.02, 1.50 revised (kp) Moved to jvx.rsrc from jv.rsrc.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `boolean` | `m_bDebugOn` External debug flag.

  - ### Constructor Summary

    Constructors
    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.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    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.

    - ### Methods inherited from class java.lang.Object

      `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### m_bDebugOn

          public boolean m_bDebugOn

      External debug flag.

  - ### Constructor Detail

    - #### JarResources

          public JarResources(java.lang.String jarFileName)

      creates a JarResources that can only be used in applications. It extracts all resources from a Jar into an internal hashtable, keyed by resource names.
      Parameters:
        `jarFileName` - a jar or zip file

    - #### JarResources

          public JarResources(java.lang.String jarFileName,
                              boolean isApplication)

      creates a JarResources for an applet or application. It extracts all resources from a Jar into an internal hashtable, keyed by resource names.
      Parameters:
        `jarFileName` - a jar or zip file
        `isApplication` -

  - ### Method Detail

    - #### getResource

          public byte[] getResource(java.lang.String name)

      Extracts a jar resource as a blob.
      Parameters:
        `name` - a resource name.

    - #### main

          public static void main(java.lang.String[] args)

      Is a test driver. Given a jar file and a resource name, it trys to extract the resource and then tells us whether it could or not. Example Let's say you have a JAR file which jarred up a bunch of gif image files. Now, by using JarResources, you could extract, create, and display those images on-the-fly.

               ...
               JarResources JR=new JarResources("GifBundle.jar");
               Image image=Toolkit.createImage(JR.getResource("logo.gif");
               Image logo=Toolkit.getDefaultToolkit().createImage(
                                                JR.getResources("logo.gif")
                                                );
               ...

    - #### getImageFromArchive

          public static PsImage getImageFromArchive(java.lang.String imageName,
                                                    java.lang.String jarArchive)

      Get an image from a jar archive.

      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.

      Parameters:
        `imageName` - name of image relative to root directory within the archive.
        `jarArchive` - name of jar archive including relative path.
      Version:
        18.10.00, 1.10 (kp) Method generated from Eike's developer applet.
        18.10.00, 1.00 (ep) Code created inside a developer applet.

"

The software JavaView? is copyright protected. All Rights Reserved.
"