Package org.codehaus.cargo.module
Interface JarArchive
-
- All Known Subinterfaces:
EarArchive
,EjbArchive
,JarArchiveUpdateable
,WarArchive
- All Known Implementing Classes:
DefaultEarArchive
,DefaultEjbArchive
,DefaultJarArchive
,DefaultWarArchive
,MergedWarArchive
public interface JarArchive
Provide convenient methods to read information from a Jar archive.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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.InputStream
getResource(String path)
Returns a resource from the archive as input stream.List<String>
getResources(String path)
Returns the list of resources in the specified directory in the archive.
-
-
-
Method Detail
-
containsClass
boolean containsClass(String className) throws 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:
IOException
- If an I/O error occurred reading the archive
-
findResource
String findResource(String name) throws 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:
IOException
- If an I/O error occurred reading the archive
-
getResource
InputStream getResource(String path) throws 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:
IOException
- If an I/O error occurs
-
getResources
List<String> getResources(String path) throws IOException
Returns the list of resources in the specified directory in the archive.- Parameters:
path
- The directory- Returns:
- The list of resources
- Throws:
IOException
- If an I/O error occurs
-
expandToPath
void expandToPath(String path) throws IOException
Expand the archive to the specified directory.- Parameters:
path
- The path to expand to- Throws:
IOException
- If an I/O error occurs
-
-