net.sourceforge.jaulp.file.zip
Class ZipUtils

java.lang.Object
  extended by net.sourceforge.jaulp.file.zip.ZipUtils

public class ZipUtils
extends java.lang.Object

The Class ZipUtils provides functionality for ziping and unzipping files.

Version:
1.0
Author:
Asterios Raptis

Constructor Summary
ZipUtils()
           
 
Method Summary
static void extractZipEntry(java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry target, java.io.File toDirectory)
          Extract zip entry.
static boolean isZip(java.lang.String filename)
          Checks if the given filename is a zip-file.
static void unzip(java.util.zip.ZipFile zipFile, java.io.File toDir)
          Unzip.
static void zip(java.io.File fileToZip, java.io.File zipFile)
          Zip the given file.
static void zip(java.io.File dirToZip, java.io.File zipFile, java.io.FilenameFilter filter)
          Zip the given file.
static void zip(java.io.File dirToZip, java.io.File zipFile, java.io.FilenameFilter filter, boolean createFile)
          Zip the given file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipUtils

public ZipUtils()
Method Detail

extractZipEntry

public static void extractZipEntry(java.util.zip.ZipFile zipFile,
                                   java.util.zip.ZipEntry target,
                                   java.io.File toDirectory)
                            throws java.io.IOException
Extract zip entry.

Parameters:
zipFile - the zip file
target - the target
toDirectory - the to directory
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

isZip

public static boolean isZip(java.lang.String filename)
Checks if the given filename is a zip-file.

Parameters:
filename - The filename to check.
Returns:
True if the filename is a zip-file otherwise false.

unzip

public static void unzip(java.util.zip.ZipFile zipFile,
                         java.io.File toDir)
                  throws java.io.IOException
Unzip.

Parameters:
zipFile - the zip file
toDir - the to dir
Throws:
java.io.IOException - Signals that an I/O exception has occurred.

zip

public static void zip(java.io.File fileToZip,
                       java.io.File zipFile)
                throws java.lang.Exception
Zip the given file.

Parameters:
fileToZip - the file to zip.
Throws:
java.io.IOException - Signals that an I/O exception has occurred.
java.lang.Exception

zip

public static void zip(java.io.File dirToZip,
                       java.io.File zipFile,
                       java.io.FilenameFilter filter)
Zip the given file.

Parameters:
dirToZip - the dir to zip
zipFile - the zip file
filter - the filter

zip

public static void zip(java.io.File dirToZip,
                       java.io.File zipFile,
                       java.io.FilenameFilter filter,
                       boolean createFile)
Zip the given file.

Parameters:
dirToZip - the dir to zip
zipFile - the zip file
filter - the filter


Copyright © 2010. All Rights Reserved.