org.codehaus.cargo.module
Interface JarArchive

All Known Subinterfaces:
EarArchive, EjbArchive, WarArchive
All Known Implementing Classes:
DefaultEarArchive, DefaultEjbArchive, DefaultJarArchive, DefaultWarArchive, WarArchiveMerger.MergedWarArchive

public interface JarArchive

Provide convenient methods to read information from a Jar archive.

Version:
$Id: JarArchive.java 1158 2006-07-29 10:55:48Z vmassol $

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.
 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.
 

Method Detail

containsClass

public boolean containsClass(java.lang.String className)
                      throws java.io.IOException
Returns whether a class of the specified name is contained in the archive.

Parameters:
className - The name of the class to search for
Returns:
Whether the class was found
Throws:
java.io.IOException - If an I/O error occurred reading the archive

findResource

public java.lang.String findResource(java.lang.String name)
                              throws java.io.IOException
Returns the full path of a named resource in the archive.

Parameters:
name - The name of the resource
Returns:
The full path to the resource inside the archive
Throws:
java.io.IOException - If an I/O error occurred reading the archive

getResource

public java.io.InputStream getResource(java.lang.String path)
                                throws java.io.IOException
Returns a resource from the archive as input stream.

Parameters:
path - The path to the resource in the archive
Returns:
An input stream containing the specified resource, or null if the resource was not found in the JAR
Throws:
java.io.IOException - If an I/O error occurs

getResources

public java.util.List getResources(java.lang.String path)
                            throws java.io.IOException
Returns the list of resources in the specified directory in the archive.

Parameters:
path - The directory
Returns:
The list of resources
Throws:
java.io.IOException - If an I/O error occurs

expandToPath

public void expandToPath(java.lang.String path)
                  throws java.io.IOException
Expand the archive to the specified directory.

Parameters:
path - The path to expand to
Throws:
java.io.IOException - If an I/O error occurs


Copyright © 2004-2008 Codehaus. All Rights Reserved.