org.jgap.util
Class JarResources
- java.lang.Object
-
- org.jgap.util.JarResources
-
public final class JarResources extends java.lang.ObjectJarResources maps all resources included in a zip or jar file. Additionaly, it provides a method to extract one as a blob.- Since:
- 3.2
-
-
Field Summary
Fields Modifier and Type Field and Description booleandebugOn
-
Constructor Summary
Constructors Constructor and Description JarResources(java.lang.String jarFileName)creates a JarResources.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description byte[]getResource(java.lang.String name)Extracts a jar resource as a blob.static voidmain(java.lang.String[] args)Is a test driver.
-
-
-
Constructor Detail
-
JarResources
public JarResources(java.lang.String jarFileName)
creates a JarResources. It extracts all resources from a Jar into an internal hashtable, keyed by resource names.- Parameters:
jarFileName- a jar or zip file
-
-
Method Detail
-
getResource
public byte[] getResource(java.lang.String name)
Extracts a jar resource as a blob.- Parameters:
name- a resource name- Returns:
- extracted blob
-
main
public static void main(java.lang.String[] args) throws java.io.IOExceptionIs 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:
args- arguments- Throws:
java.io.IOException
-
-
DMelt 3.0 © DataMelt by jWork.ORG