org.apache.cactus.integration.ant.deployment
Class DefaultJarArchive

java.lang.Object
  extended byorg.apache.cactus.integration.ant.deployment.DefaultJarArchive
All Implemented Interfaces:
JarArchive
Direct Known Subclasses:
DefaultEarArchive, DefaultWarArchive

public class DefaultJarArchive
extends java.lang.Object
implements JarArchive

Provide convenient methods to read information from a Jar archive.

Since:
Cactus 1.5
Version:
$Id: DefaultJarArchive.java,v 1.1.2.1 2003/10/25 17:22:05 vmassol Exp $
Author:
Christopher Lenz

Constructor Summary
DefaultJarArchive(java.io.File theFile)
          Constructor.
DefaultJarArchive(java.io.InputStream theInputStream)
          Constructor.
 
Method Summary
 boolean containsClass(java.lang.String theClassName)
          Returns whether a class of the specified name is contained in the archive.
 java.lang.String findResource(java.lang.String theName)
          Returns the full path of a named resource in the archive.
 java.io.InputStream getResource(java.lang.String thePath)
          Returns a resource from the archive as input stream.
 java.util.List getResources(java.lang.String thePath)
          Returns the list of resources in the specified directory.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultJarArchive

public DefaultJarArchive(java.io.File theFile)
                  throws java.io.IOException
Constructor.

Parameters:
theFile - The archive file
Throws:
java.io.IOException - If there was a problem reading the WAR

DefaultJarArchive

public DefaultJarArchive(java.io.InputStream theInputStream)
                  throws java.io.IOException
Constructor.

Parameters:
theInputStream - The input stream for the archive (it will be closed after the constructor returns)
Throws:
java.io.IOException - If there was a problem reading the WAR
Method Detail

containsClass

public boolean containsClass(java.lang.String theClassName)
                      throws java.io.IOException
Description copied from interface: JarArchive
Returns whether a class of the specified name is contained in the archive.

Specified by:
containsClass in interface JarArchive
Parameters:
theClassName - 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
See Also:
JarArchive.containsClass(String)

findResource

public final java.lang.String findResource(java.lang.String theName)
                                    throws java.io.IOException
Description copied from interface: JarArchive
Returns the full path of a named resource in the archive.

Specified by:
findResource in interface JarArchive
Parameters:
theName - 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
See Also:
JarArchive.findResource(String)

getResource

public final java.io.InputStream getResource(java.lang.String thePath)
                                      throws java.io.IOException
Description copied from interface: JarArchive
Returns a resource from the archive as input stream.

Specified by:
getResource in interface JarArchive
Parameters:
thePath - 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
See Also:
JarArchive.getResource(String)

getResources

public final java.util.List getResources(java.lang.String thePath)
                                  throws java.io.IOException
Description copied from interface: JarArchive
Returns the list of resources in the specified directory.

Specified by:
getResources in interface JarArchive
Parameters:
thePath - The directory
Returns:
The list of resources
Throws:
java.io.IOException - If an I/O error occurs
See Also:
JarArchive.getResources(String)


Copyright © 2000-2003 Apache Software Foundation. All Rights Reserved.