org.dmonix.util.zip
Class ZipUtil

java.lang.Object
  extended byorg.dmonix.util.zip.ZipUtil

public abstract class ZipUtil
extends java.lang.Object

Utility class for performing ZIP related operations.

Copyright: Copyright (c) 2004

Company: dmonix.org

Version:
1.0
Author:
Peter Nerg

Method Summary
static int packDirectory(java.io.File dir, java.io.File zipFile)
          Packs all files in the given directory to a ZIP file.
static int packDirectory(java.io.File dir, java.io.FileFilter filter, java.io.File zipFile)
          Packs all matching files in the given directory to a ZIP file.
 void packFiles(java.io.File[] files, java.io.File zipFile)
          Creates a ZIP file and includes the given files.
 int unzipFile(java.io.File zipFile, java.io.File path)
          Unzips all entries in a ZIP file to the specified destination.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

packDirectory

public static int packDirectory(java.io.File dir,
                                java.io.File zipFile)
                         throws java.io.IOException
Packs all files in the given directory to a ZIP file.

Parameters:
dir - The directory
zipFile - The ZIP file
Returns:
The number of files written to the ZIP file
Throws:
java.io.IOException

packDirectory

public static int packDirectory(java.io.File dir,
                                java.io.FileFilter filter,
                                java.io.File zipFile)
                         throws java.io.IOException
Packs all matching files in the given directory to a ZIP file.
Only the files that match the filter will be included in the ZIP file.

Parameters:
dir - The directory
filter - The filter
zipFile - The ZIP file
Returns:
The number of files written to the ZIP file
Throws:
java.io.IOException

packFiles

public void packFiles(java.io.File[] files,
                      java.io.File zipFile)
               throws java.io.IOException
Creates a ZIP file and includes the given files.

Parameters:
files - The files to include in the ZIP file
zipFile - The ZIP file
Throws:
java.io.IOException

unzipFile

public int unzipFile(java.io.File zipFile,
                     java.io.File path)
              throws java.io.IOException
Unzips all entries in a ZIP file to the specified destination.

Parameters:
zipFile - The ZIP file
path - The destination
Returns:
The number of deflated files
Throws:
java.io.IOException


Copyright © 1998-2005 dmonix.org Peter Nerg, All Rights Reserved.