org.apache.openejb.util
Class JarExtractor

java.lang.Object
  extended by org.apache.openejb.util.JarExtractor

public class JarExtractor
extends Object

Version:
$Rev: 637617 $ $Date: 2008-03-16 18:42:30 +0100 (So, 16. Mär 2008) $

Field Summary
static Logger logger
           
 
Constructor Summary
JarExtractor()
           
 
Method Summary
static boolean copy(File src, File dest)
          Copy the specified file or directory to the destination.
static boolean delete(File dir)
          Delete the specified directory, including all of its contents and subdirectories recursively.
static boolean deleteDir(File dir)
          Delete the specified directory, including all of its contents and subdirectories recursively.
static void extract(File file, File destinationDir)
          Extract the jar file into the specifiec destination directory.
static File extract(File file, String pathname)
          Extract the Jar file into an unpacked directory structure, and return the absolute pathname to the extracted directory.
protected static File extract(InputStream input, File docBase, String name)
          Extract the specified input stream into the specified directory, creating a file named from the specified relative path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static final Logger logger
Constructor Detail

JarExtractor

public JarExtractor()
Method Detail

extract

public static File extract(File file,
                           String pathname)
                    throws IOException
Extract the Jar file into an unpacked directory structure, and return the absolute pathname to the extracted directory.

Parameters:
file - Jar file to unpack
pathname - Context path name for web application
Throws:
IllegalArgumentException - if this is not a "jar:" URL
IOException - if an input/output error was encountered during expansion

extract

public static void extract(File file,
                           File destinationDir)
                    throws IOException
Extract the jar file into the specifiec destination directory. If the destination directory already exists, the jar will not be unpacked.

Parameters:
file - jar file to unpack
destinationDir - the directory in which the jar will be unpacked; must not exist
Throws:
IOException - if an input/output error was encountered during expansion

copy

public static boolean copy(File src,
                           File dest)
Copy the specified file or directory to the destination.

Parameters:
src - File object representing the source
dest - File object representing the destination

delete

public static boolean delete(File dir)
Delete the specified directory, including all of its contents and subdirectories recursively.

Parameters:
dir - File object representing the directory to be deleted

deleteDir

public static boolean deleteDir(File dir)
Delete the specified directory, including all of its contents and subdirectories recursively.

Parameters:
dir - File object representing the directory to be deleted

extract

protected static File extract(InputStream input,
                              File docBase,
                              String name)
                       throws IOException
Extract the specified input stream into the specified directory, creating a file named from the specified relative path.

Parameters:
input - InputStream to be copied
docBase - Document base directory into which we are extracting
name - Relative pathname of the file to be created
Returns:
A handle to the extracted File
Throws:
IOException - if an input/output error occurs


Copyright © 1999-2013 The Apache OpenEJB development community. All Rights Reserved.