org.sourcejammer.util
Class ZipUtil

java.lang.Object
  |
  +--org.sourcejammer.util.ZipUtil

public class ZipUtil
extends java.lang.Object

Static utility methods for zipping data.


Field Summary
private static int STREAM_BUFFER_SIZE
           
static int ZIP_BUFFER_SIZE
           
 
Constructor Summary
private ZipUtil()
           
 
Method Summary
static boolean canZip(java.lang.String fileName)
          Checks passed-in file name against list of extensions not to zip.
private static void inflaterInputStmToFileOutputStm(java.util.zip.InflaterInputStream stmIn, java.io.FileOutputStream stmOut)
           
static void main(java.lang.String[] args)
           
private static void simpleInputStreamToOutputStream(java.io.InputStream stmIn, java.io.OutputStream stmOut)
           
static byte[] unzipByteArray(byte[] file)
          Inflates a previously deflated file.
static void unzipFileToFile(java.io.File flSource, java.io.File flTarget)
           
static void unZipZipFileToLocation(java.io.File zipFile, java.io.File targetDir)
           
static byte[] zipByteArray(byte[] file)
          Deflates the file and returns the deflated file.
static void zipFileToFile(java.io.File flSource, java.io.File flTarget)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ZIP_BUFFER_SIZE

public static final int ZIP_BUFFER_SIZE
See Also:
Constant Field Values

STREAM_BUFFER_SIZE

private static final int STREAM_BUFFER_SIZE
See Also:
Constant Field Values
Constructor Detail

ZipUtil

private ZipUtil()
Method Detail

zipByteArray

public static byte[] zipByteArray(byte[] file)
                           throws java.io.IOException
Deflates the file and returns the deflated file.

java.io.IOException

unzipByteArray

public static byte[] unzipByteArray(byte[] file)
                             throws java.io.IOException
Inflates a previously deflated file.

java.io.IOException

zipFileToFile

public static void zipFileToFile(java.io.File flSource,
                                 java.io.File flTarget)
                          throws java.io.IOException
java.io.IOException

unzipFileToFile

public static void unzipFileToFile(java.io.File flSource,
                                   java.io.File flTarget)
                            throws java.io.IOException
java.io.IOException

inflaterInputStmToFileOutputStm

private static void inflaterInputStmToFileOutputStm(java.util.zip.InflaterInputStream stmIn,
                                                    java.io.FileOutputStream stmOut)
                                             throws java.io.IOException
java.io.IOException

canZip

public static boolean canZip(java.lang.String fileName)
Checks passed-in file name against list of extensions not to zip. Returns true if no matches, false if a match to file extension is found.


main

public static void main(java.lang.String[] args)

unZipZipFileToLocation

public static void unZipZipFileToLocation(java.io.File zipFile,
                                          java.io.File targetDir)
                                   throws java.io.IOException
java.io.IOException

simpleInputStreamToOutputStream

private static void simpleInputStreamToOutputStream(java.io.InputStream stmIn,
                                                    java.io.OutputStream stmOut)
                                             throws java.io.IOException
java.io.IOException


Copyright 2003 Soucejammer project.