public class DefaultJarArchive extends Object implements JarArchive
| Constructor and Description |
|---|
DefaultJarArchive(InputStream inputStream)
Constructor.
|
DefaultJarArchive(String file)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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.
|
public DefaultJarArchive(String file)
file - The archive filepublic 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 WARpublic 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 forIOException - 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 resourceIOException - 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 archivenull if the resource was not found in the JARIOException - If an I/O error occursJarArchive.getResource(String)public final List getResources(String path) throws IOException
getResources in interface JarArchivepath - The directoryIOException - If an I/O error occursJarArchive.getResources(String)protected final JarInputStream getContentAsStream() throws IOException
JarInputStream.IOException - If an exception occurred reading the archivepublic void expandToPath(String path) throws IOException
expandToPath in interface JarArchivepath - The path to expand toIOException - If an I/O error occursJarArchive.expandToPath(String)protected byte[] streamToByteArray(InputStream inputStream) throws IOException
inputStream - the input streamIOException - if an IO ExceptionCopyright © 2004-2013 Codehaus. All Rights Reserved.