|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnl.knowledgeplaza.util.JarResources
public class JarResources
Access all resources included in a Zip or Jar file. Per default the complete file is NOT kept in memory, but each resource is extracted separately. For better performance, the whole resource may be read into memory (cacheAll). If an InputStream is used, only one resource can be read (because InputStreams cannot be reversed), or all entries must be kept in memory (cacheAll).
| Field Summary | |
|---|---|
static String |
SOURCECODE_VERSION
Standard variable for determining version of a class file. |
| Constructor Summary | |
|---|---|
JarResources(File file)
|
|
JarResources(File file,
boolean cacheAll)
|
|
JarResources(InputStream is,
boolean cacheAll)
creates a JarResources. |
|
JarResources(String jarFileName)
|
|
JarResources(String jarFileName,
boolean cacheAll)
|
|
| Method Summary | |
|---|---|
boolean |
getCacheAll()
CacheAll |
byte[] |
getResource(String name)
Extracts a jar resource |
byte[] |
getResource2(String name)
Extracts a jar resource, IOException just returns null |
InputStream |
getResourceAsStream(String name)
Extracts a jar resource as a blob. |
InputStream |
getResourceAsStream2(String name)
Extracts a jar resource, IOException just returns null |
String[] |
getResourceNames()
Extracts a jar resource |
void |
setCacheAll(boolean value)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String SOURCECODE_VERSION
| Constructor Detail |
|---|
public JarResources(String jarFileName)
throws FileNotFoundException
jarFileName - a jar or zip filename
FileNotFoundException
public JarResources(String jarFileName,
boolean cacheAll)
throws FileNotFoundException
jarFileName - a jar or zip filenamecacheAll - read whole file into memory (uncompressed!)
FileNotFoundException
public JarResources(File file)
throws FileNotFoundException
file - a jar or zip file
FileNotFoundException
public JarResources(File file,
boolean cacheAll)
throws FileNotFoundException
file - a jar or zip filecacheAll - read whole file into memory (uncompressed!)
FileNotFoundException
public JarResources(InputStream is,
boolean cacheAll)
is - an jar or zip inputstreamcacheAll - read all in memory (this is required to be able to access multiple resources)| Method Detail |
|---|
public boolean getCacheAll()
public void setCacheAll(boolean value)
public String[] getResourceNames()
throws IOException
name - a resource name.
IOException
public byte[] getResource(String name)
throws IOException
name - a resource name.
IOExceptionpublic byte[] getResource2(String name)
name - a resource name.
public InputStream getResourceAsStream(String name)
throws IOException
name - a resource name.
IOExceptionpublic InputStream getResourceAsStream2(String name)
name - a resource name.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||