|
||||||||||
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(java.io.InputStream inputStream)
Constructor. |
|
DefaultJarArchive(java.lang.String file)
Constructor. |
Method Summary | |
---|---|
boolean |
containsClass(java.lang.String className)
Returns whether a class of the specified name is contained in the archive. |
void |
expandToPath(java.lang.String path)
Expand the archive to the specified directory. |
java.lang.String |
findResource(java.lang.String name)
Returns the full path of a named resource in the archive. |
protected java.util.jar.JarInputStream |
getContentAsStream()
Returns the content of the archive as JarInputStream . |
org.codehaus.cargo.util.FileHandler |
getFileHandler()
|
java.io.InputStream |
getResource(java.lang.String path)
Returns a resource from the archive as input stream. |
java.util.List |
getResources(java.lang.String path)
Returns the list of resources in the specified directory in the archive. |
void |
setFileHandler(org.codehaus.cargo.util.FileHandler fileHandler)
|
protected byte[] |
streamToByteArray(java.io.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(java.lang.String file)
file
- The archive filepublic DefaultJarArchive(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- The input stream for the archive (it will be closed after the
constructor returns)
java.io.IOException
- If there was a problem reading the WARMethod Detail |
---|
public org.codehaus.cargo.util.FileHandler getFileHandler()
public void setFileHandler(org.codehaus.cargo.util.FileHandler fileHandler)
fileHandler
- the file utility class to use for performing all file I/O.public boolean containsClass(java.lang.String className) throws java.io.IOException
containsClass
in interface JarArchive
className
- The name of the class to search for
java.io.IOException
- If an I/O error occurred reading the archiveJarArchive.containsClass(String)
public final java.lang.String findResource(java.lang.String name) throws java.io.IOException
findResource
in interface JarArchive
name
- The name of the resource
java.io.IOException
- If an I/O error occurred reading the archiveJarArchive.findResource(String)
public final java.io.InputStream getResource(java.lang.String path) throws java.io.IOException
getResource
in interface JarArchive
path
- The path to the resource in the archive
null
if the resource was not found in the JAR
java.io.IOException
- If an I/O error occursJarArchive.getResource(String)
public final java.util.List getResources(java.lang.String path) throws java.io.IOException
getResources
in interface JarArchive
path
- The directory
java.io.IOException
- If an I/O error occursJarArchive.getResources(String)
protected final java.util.jar.JarInputStream getContentAsStream() throws java.io.IOException
JarInputStream
.
java.io.IOException
- If an exception occurred reading the archivepublic void expandToPath(java.lang.String path) throws java.io.IOException
expandToPath
in interface JarArchive
path
- The path to expand to
java.io.IOException
- If an I/O error occursJarArchive.expandToPath(String)
protected byte[] streamToByteArray(java.io.InputStream inputStream) throws java.io.IOException
inputStream
- the input stream
java.io.IOException
- if an IO Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |