public class JarExtractor
extends java.lang.Object
Constructor and Description |
---|
JarExtractor() |
Modifier and Type | Method and Description |
---|---|
static boolean |
copyRecursively(java.io.File src,
java.io.File dest)
Copy the specified file or directory to the destination.
|
static boolean |
delete(java.io.File dir)
Delete the specified directory, including all of its contents and
subdirectories recursively.
|
static boolean |
deleteDir(java.io.File dir)
Delete the specified directory, including all of its contents and
subdirectories recursively.
|
static java.io.File |
extract(java.io.File file,
java.io.File destinationDir)
Extract the jar file into the specifiec destination directory.
|
static java.io.File |
extract(java.io.File file,
java.lang.String pathname)
Extract the Jar file into an unpacked directory structure, and
return the absolute pathname to the extracted directory.
|
protected static java.io.File |
extract(java.io.InputStream input,
java.io.File docBase,
java.lang.String name)
Extract the specified input stream into the specified directory, creating
a file named from the specified relative path.
|
public static final Logger logger
public static java.io.File extract(java.io.File file, java.lang.String pathname) throws java.io.IOException
file
- Jar file to unpackpathname
- Context path name for web applicationjava.lang.IllegalArgumentException
- if this is not a "jar:" URLjava.io.IOException
- if an input/output error was encountered
during expansionpublic static java.io.File extract(java.io.File file, java.io.File destinationDir) throws java.io.IOException
file
- jar file to unpackdestinationDir
- the directory in which the jar will be unpacked; must not existjava.io.IOException
- if an input/output error was encountered during expansionpublic static boolean copyRecursively(java.io.File src, java.io.File dest)
src
- File object representing the sourcedest
- File object representing the destinationpublic static boolean delete(java.io.File dir)
dir
- File object representing the directory to be deletedpublic static boolean deleteDir(java.io.File dir)
dir
- File object representing the directory to be deletedprotected static java.io.File extract(java.io.InputStream input, java.io.File docBase, java.lang.String name) throws java.io.IOException
input
- InputStream to be copieddocBase
- Document base directory into which we are extractingname
- Relative pathname of the file to be createdjava.io.IOException
- if an input/output error occurs