futils
Class ZipUtils

java.lang.Object
  extended by futils.ZipUtils

public class ZipUtils
extends java.lang.Object

DocJava, Inc. http://www.docjava.com Programmer: dlyon Date: Sep 22, 2004 Time: 7:20:01 PM


Constructor Summary
ZipUtils()
           
 
Method Summary
static java.io.File createJar(java.io.File jarFile, java.io.File workingDir)
          Create a jar file from the contents of the working directory
static byte[] getBytes(java.io.ByteArrayOutputStream baos, byte[] buffer, java.util.zip.ZipFile zf, java.util.zip.ZipEntry ze)
           
static java.util.jar.Attributes getDigestAttributes(byte[] buffer, java.util.zip.ZipEntry ze, java.util.zip.ZipFile zf, java.security.MessageDigest[] digests, sun.misc.BASE64Encoder encoder)
           
static java.lang.String[] getDigests(byte[] buffer, java.util.zip.ZipEntry ze, java.util.zip.ZipFile zf, java.security.MessageDigest[] digests, sun.misc.BASE64Encoder encoder)
           
static java.util.zip.ZipEntry getManifestFile(java.util.zip.ZipFile zf)
           
static void gunzip(java.io.File file)
          Use a small buffer to gunzip a file into a new file, without the gz suffix.
static void gzip(java.lang.String file)
           
static void jarIt()
           
static void main(java.lang.String[] args)
           
static void makeJar(java.io.File outputFile, java.lang.String s)
           
static void testCreateJar()
           
static void testUnzipper()
           
static void uncompressJarFile(java.io.File inputJarFile)
          Uncompress a jar file into the parent directory, creating directories on an as-needed basis.
static void unjar(java.io.File jarFile, java.io.File workingDir)
           
static void unjarFile()
           
static void unsignJar()
           
static void unzip(java.lang.String zipfile)
          Unzips zip and jar files.
static boolean updateDigests(byte[] buffer, java.util.zip.ZipEntry ze, java.util.zip.ZipFile zf, java.security.MessageDigest[] digests, sun.misc.BASE64Encoder encoder, java.util.jar.Manifest mf)
           
static void writeZipFiles(java.io.File outputFile, java.io.File[] filesToBeWritten)
           
static void zip(java.lang.String infile)
           
static void zip(java.lang.String outfile, java.lang.String[] filelist)
           
static void zipDirectory()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipUtils

public ZipUtils()
Method Detail

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
Throws:
java.io.IOException

unsignJar

public static void unsignJar()

testUnzipper

public static void testUnzipper()
                         throws java.io.IOException
Throws:
java.io.IOException

zipDirectory

public static void zipDirectory()

makeJar

public static void makeJar(java.io.File outputFile,
                           java.lang.String s)
                    throws java.io.IOException
Throws:
java.io.IOException

writeZipFiles

public static void writeZipFiles(java.io.File outputFile,
                                 java.io.File[] filesToBeWritten)
                          throws java.io.IOException
Throws:
java.io.IOException

getManifestFile

public static java.util.zip.ZipEntry getManifestFile(java.util.zip.ZipFile zf)

getDigests

public static java.lang.String[] getDigests(byte[] buffer,
                                            java.util.zip.ZipEntry ze,
                                            java.util.zip.ZipFile zf,
                                            java.security.MessageDigest[] digests,
                                            sun.misc.BASE64Encoder encoder)
                                     throws java.io.IOException
Throws:
java.io.IOException

getDigestAttributes

public static java.util.jar.Attributes getDigestAttributes(byte[] buffer,
                                                           java.util.zip.ZipEntry ze,
                                                           java.util.zip.ZipFile zf,
                                                           java.security.MessageDigest[] digests,
                                                           sun.misc.BASE64Encoder encoder)
                                                    throws java.io.IOException
Throws:
java.io.IOException

updateDigests

public static boolean updateDigests(byte[] buffer,
                                    java.util.zip.ZipEntry ze,
                                    java.util.zip.ZipFile zf,
                                    java.security.MessageDigest[] digests,
                                    sun.misc.BASE64Encoder encoder,
                                    java.util.jar.Manifest mf)
                             throws java.io.IOException
Throws:
java.io.IOException

getBytes

public static byte[] getBytes(java.io.ByteArrayOutputStream baos,
                              byte[] buffer,
                              java.util.zip.ZipFile zf,
                              java.util.zip.ZipEntry ze)
                       throws java.io.IOException
Throws:
java.io.IOException

jarIt

public static void jarIt()

testCreateJar

public static void testCreateJar()

createJar

public static java.io.File createJar(java.io.File jarFile,
                                     java.io.File workingDir)
Create a jar file from the contents of the working directory

Parameters:
jarFile - a file that will be placed in the working directory parent
workingDir - a working directory whose contents will be placed in the jar file.
Returns:
the location of the new jar file.

unjar

public static void unjar(java.io.File jarFile,
                         java.io.File workingDir)

gzip

public static void gzip(java.lang.String file)

gunzip

public static void gunzip(java.io.File file)
Use a small buffer to gunzip a file into a new file, without the gz suffix. This should take any size file.

Parameters:
file - to be gunzipped.

zip

public static void zip(java.lang.String outfile,
                       java.lang.String[] filelist)

zip

public static void zip(java.lang.String infile)

unzip

public static void unzip(java.lang.String zipfile)
Unzips zip and jar files.

Parameters:
zipfile - the complete path of the zip/jar file including its name.

unjarFile

public static void unjarFile()
                      throws java.io.IOException
Throws:
java.io.IOException

uncompressJarFile

public static void uncompressJarFile(java.io.File inputJarFile)
Uncompress a jar file into the parent directory, creating directories on an as-needed basis.

Parameters:
inputJarFile -