|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.codehaus.cargo.module.DefaultJarArchive
public class DefaultJarArchive
Provide convenient methods to read information from a Jar archive.
| Constructor Summary | |
|---|---|
DefaultJarArchive(InputStream inputStream)
Constructor. |
|
DefaultJarArchive(String file)
Constructor. |
|
| Method Summary | |
|---|---|
boolean |
containsClass(String className)
Returns whether a class of the specified name is contained in the archive. |
void |
expandToPath(String path)
Expand the archive to the specified directory. |
void |
expandToPath(String path,
FileFilter filter)
Expand the archive to the specified directory, filtering out files. |
String |
findResource(String name)
Returns the full path of a named resource in the archive. |
protected JarInputStream |
getContentAsStream()
Returns the content of the archive as JarInputStream. |
FileHandler |
getFileHandler()
|
InputStream |
getResource(String path)
Returns a resource from the archive as input stream. |
List |
getResources(String path)
Returns the list of resources in the specified directory in the archive. |
void |
setFileHandler(FileHandler fileHandler)
|
protected byte[] |
streamToByteArray(InputStream inputStream)
Read a stream into a byte array. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DefaultJarArchive(String file)
file - The archive file
public DefaultJarArchive(InputStream inputStream)
throws IOException
inputStream - The input stream for the archive (it will be closed after the
constructor returns)
IOException - If there was a problem reading the WAR| Method Detail |
|---|
public FileHandler getFileHandler()
public void setFileHandler(FileHandler fileHandler)
fileHandler - the file utility class to use for performing all file I/O.
public boolean containsClass(String className)
throws IOException
containsClass in interface JarArchiveclassName - The name of the class to search for
IOException - If an I/O error occurred reading the archiveJarArchive.containsClass(String)
public final String findResource(String name)
throws IOException
findResource in interface JarArchivename - The name of the resource
IOException - If an I/O error occurred reading the archiveJarArchive.findResource(String)
public final InputStream getResource(String path)
throws IOException
getResource in interface JarArchivepath - The path to the resource in the archive
null if the resource was not found in the JAR
IOException - If an I/O error occursJarArchive.getResource(String)
public final List getResources(String path)
throws IOException
getResources in interface JarArchivepath - The directory
IOException - If an I/O error occursJarArchive.getResources(String)
protected final JarInputStream getContentAsStream()
throws IOException
JarInputStream.
IOException - If an exception occurred reading the archive
public void expandToPath(String path)
throws IOException
expandToPath in interface JarArchivepath - The path to expand to
IOException - If an I/O error occursJarArchive.expandToPath(String)
public void expandToPath(String path,
FileFilter filter)
throws IOException
expandToPath in interface JarArchivepath - The path to expand tofilter - The filter to use
IOException - If an I/O error occursJarArchive.expandToPath(String, FileFilter)
protected byte[] streamToByteArray(InputStream inputStream)
throws IOException
inputStream - the input stream
IOException - if an IO Exception
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||