org.apache.geronimo.kernel.util
Class JarUtils

java.lang.Object
  extended by org.apache.geronimo.kernel.util.JarUtils

public final class JarUtils
extends Object

Version:
$Rev: 1307840 $ $Date: 2012-04-01 00:13:05 +0800 (Sun, 01 Apr 2012) $

Field Summary
static File DUMMY_JAR_FILE
           
static String TEMP_FILE_NAME
           
 
Method Summary
static void assertTempFile()
           
static void close(JarFile thing)
           
static void close(ZipFile thing)
           
static void copyToPackedJar(JarFile inputJar, File outputFile)
           
static JarFile createJarFile(File jarFile)
           
static URL createJarURL(JarFile jarFile, String path)
           
static boolean isJarFile(File file)
          Determine whether a file is a JAR File.
static boolean isZipFile(File file)
          Determine whether a file is a ZIP File.
static void jarDirectory(File sourceDirectory, File destinationFile)
           
static String readAll(URL url)
           
static File toFile(JarFile jarFile)
           
static File toFile(JarFile jarFile, String path)
           
static File toTempFile(JarFile jarFile, String path)
           
static File toTempFile(URL url)
           
static void unzipToDirectory(ZipFile zipFile, File destDir)
           
static void unzipToDirectory(ZipFile zipFile, File destDir, String prefix)
           
static void unzipToDirectory(ZipFile zipFile, File destDir, String prefix, boolean stripPrefix)
           
static void unzipToDirectory(ZipInputStream zipIn, File destDir)
           
static void unzipToDirectory(ZipInputStream zipIn, File destDir, String prefix, boolean stripPrefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DUMMY_JAR_FILE

public static final File DUMMY_JAR_FILE

TEMP_FILE_NAME

public static final String TEMP_FILE_NAME
Method Detail

assertTempFile

public static void assertTempFile()
                           throws IOException
Throws:
IOException

toTempFile

public static File toTempFile(JarFile jarFile,
                              String path)
                       throws IOException
Throws:
IOException

toTempFile

public static File toTempFile(URL url)
                       throws IOException
Throws:
IOException

readAll

public static String readAll(URL url)
                      throws IOException
Throws:
IOException

toFile

public static File toFile(JarFile jarFile)
                   throws IOException
Throws:
IOException

toFile

public static File toFile(JarFile jarFile,
                          String path)
                   throws IOException
Throws:
IOException

createJarURL

public static URL createJarURL(JarFile jarFile,
                               String path)
                        throws MalformedURLException
Throws:
MalformedURLException

createJarFile

public static JarFile createJarFile(File jarFile)
                             throws IOException
Throws:
IOException

copyToPackedJar

public static void copyToPackedJar(JarFile inputJar,
                                   File outputFile)
                            throws IOException
Throws:
IOException

jarDirectory

public static void jarDirectory(File sourceDirectory,
                                File destinationFile)
                         throws IOException
Throws:
IOException

unzipToDirectory

public static void unzipToDirectory(ZipInputStream zipIn,
                                    File destDir,
                                    String prefix,
                                    boolean stripPrefix)
                             throws IOException
Throws:
IOException

unzipToDirectory

public static void unzipToDirectory(ZipInputStream zipIn,
                                    File destDir)
                             throws IOException
Throws:
IOException

unzipToDirectory

public static void unzipToDirectory(ZipFile zipFile,
                                    File destDir,
                                    String prefix,
                                    boolean stripPrefix)
                             throws IOException
Throws:
IOException

unzipToDirectory

public static void unzipToDirectory(ZipFile zipFile,
                                    File destDir,
                                    String prefix)
                             throws IOException
Throws:
IOException

unzipToDirectory

public static void unzipToDirectory(ZipFile zipFile,
                                    File destDir)
                             throws IOException
Throws:
IOException

close

public static void close(JarFile thing)

close

public static void close(ZipFile thing)

isJarFile

public static boolean isJarFile(File file)
                         throws IOException
Determine whether a file is a JAR File. Note: Jar file is a zip file with an *optional* META-INF directory. Therefore, there is no reliable way to check if a file is a Jar file. So this functions returns the same as calling isZipFile(File).

Throws:
IOException

isZipFile

public static boolean isZipFile(File file)
                         throws IOException
Determine whether a file is a ZIP File.

Throws:
IOException


Copyright © 2003-2013 The Apache Geronimo development community. All Rights Reserved.