Project CASUAL
API for CASUAL
 All Classes Namespaces Functions Variables
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
CASUAL.misc.JarResources Class Reference

Public Member Functions

 JarResources (String jarFileName)
 
byte[] getResource (String name)
 
 JarResources (String jarFileName)
 
byte[] getResource (String name)
 

Static Public Member Functions

static void main (String[] args) throws IOException
 
static void main (String[] args) throws IOException
 

Public Attributes

boolean debugOn = false
 

Detailed Description

JarResources: JarResources maps all resources included in a Zip or Jar file. Additionaly, it provides a method to extract one as a blob.

Constructor & Destructor Documentation

CASUAL.misc.JarResources.JarResources ( String  jarFileName)

creates a JarResources. It extracts all resources from a Jar into an internal hashtable, keyed by resource names.

Parameters
jarFileNamea jar or zip file
CASUAL.misc.JarResources.JarResources ( String  jarFileName)

creates a JarResources. It extracts all resources from a Jar into an internal hashtable, keyed by resource names.

Parameters
jarFileNamea jar or zip file

Member Function Documentation

byte [] CASUAL.misc.JarResources.getResource ( String  name)

Extracts a jar resource as a blob.

Parameters
namea resource name.
Returns
resource as a byte array.
byte [] CASUAL.misc.JarResources.getResource ( String  name)

Extracts a jar resource as a blob.

Parameters
namea resource name.
Returns
resource as a byte array.
static void CASUAL.misc.JarResources.main ( String[]  args) throws IOException
static

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")
                  );
    ...
Parameters
argsargs for main method.
Exceptions
java.io.IOException
static void CASUAL.misc.JarResources.main ( String[]  args) throws IOException
static

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")
                  );
    ...
Parameters
argsargs for main method.
Exceptions
java.io.IOException

Member Data Documentation

boolean CASUAL.misc.JarResources.debugOn = false

external debug flag


The documentation for this class was generated from the following file: