de.uplanet.io
Class ZipHelper

java.lang.Object
  extended by de.uplanet.io.ZipHelper

@Scriptable
public final class ZipHelper
extends java.lang.Object

IOHelper class utility

Version:
$Revision: 86964 $

Constructor Summary
ZipHelper()
           
 
Method Summary
static void unzipDir(java.io.File p_fileZip, java.io.File p_dirDst)
          Extract a ZIP archive to a directory.
static void unzipDir(java.util.zip.ZipFile p_zip, java.lang.String p_strRootDir, java.io.File p_dirDst)
          This method calls unzipDir(ZipFile, String, File, Progress) with a null progress parameter.
static boolean unzipDir(java.util.zip.ZipFile p_zip, java.lang.String p_strRootDir, java.io.File p_dirDst, de.uplanet.util.Progress p_progress)
          Copy a directory recursively from a ZIP file.
static void unzipDir(java.util.zip.ZipInputStream p_zip, java.lang.String p_strPrefixFilter, java.io.File p_dirDst)
          Extract a ZIP stream into a directory.
static void zipDir(java.io.File p_fileZip, java.io.File p_dirSrc)
          Copy a directory recursively to a ZIP file.
static void zipDir(java.util.zip.ZipOutputStream p_zip, java.lang.String p_strRootDir, java.io.File p_dirSrc)
          Copy a directory recursively to a ZIP output stream.
static void zipDir(java.util.zip.ZipOutputStream p_zip, java.lang.String p_strRootDir, java.io.File p_dirSrc, boolean p_bZipMarkedDirs, java.util.Set<java.io.File> p_filesToExclude)
          Copy a directory recursively to a ZIP output stream.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipHelper

public ZipHelper()
Method Detail

zipDir

public static void zipDir(java.io.File p_fileZip,
                          java.io.File p_dirSrc)
                   throws java.io.IOException
Copy a directory recursively to a ZIP file.

Parameters:
p_fileZip - The output file.
p_dirSrc - The directory to be archived.
Throws:
java.io.IOException - If an I/O-error occurs.

zipDir

public static void zipDir(java.util.zip.ZipOutputStream p_zip,
                          java.lang.String p_strRootDir,
                          java.io.File p_dirSrc)
                   throws java.io.IOException
Copy a directory recursively to a ZIP output stream.

Parameters:
p_zip - A ZIP output stream.
p_strRootDir - The root directory for the added files, or null, if top level.
p_dirSrc - The directory to copy.
Throws:
java.io.IOException - If an I/O-error occurs.

zipDir

public static void zipDir(java.util.zip.ZipOutputStream p_zip,
                          java.lang.String p_strRootDir,
                          java.io.File p_dirSrc,
                          boolean p_bZipMarkedDirs,
                          java.util.Set<java.io.File> p_filesToExclude)
                   throws java.io.IOException
Copy a directory recursively to a ZIP output stream.

p_dest is the parent directory of the new directory.

Parameters:
p_zip - The ZIP output stream.
p_strRootDir - The root directory for the added files, or null, if top level.
p_dirSrc - The directory to copy.
p_bZipMarkedDirs - Zips directories, even if they are marked with a ".noexport" file. If this
p_filesToExclude - Files to exclude parameter is set to false, the directory is exported as it would be empty.
Throws:
java.io.IOException - If an I/O-error occurs.

unzipDir

public static void unzipDir(java.util.zip.ZipInputStream p_zip,
                            java.lang.String p_strPrefixFilter,
                            java.io.File p_dirDst)
                     throws java.io.IOException
Extract a ZIP stream into a directory.

Parameters:
p_zip - The stream to be uzipped.
p_strPrefixFilter - A prefix for the files that are to be extracted, or null if all files should be extracted. Forward slashes are used as path delimiters.
p_dirDst - The destination directory.
Throws:
java.io.IOException - If an I/O-error occurs.

unzipDir

public static void unzipDir(java.io.File p_fileZip,
                            java.io.File p_dirDst)
                     throws java.io.IOException
Extract a ZIP archive to a directory.

Parameters:
p_fileZip - The file to be uzipped.
p_dirDst - The destination directory.
Throws:
java.io.IOException - If an I/O-error occurs.

unzipDir

public static void unzipDir(java.util.zip.ZipFile p_zip,
                            java.lang.String p_strRootDir,
                            java.io.File p_dirDst)
                     throws java.io.IOException
This method calls unzipDir(ZipFile, String, File, Progress) with a null progress parameter.

Parameters:
p_zip - The file to be uzipped.
p_strRootDir - The root dir of the files in the zip, or null, if top level.
p_dirDst - The destination directory.
Throws:
java.io.IOException - If an I/O-error occurs.

unzipDir

public static boolean unzipDir(java.util.zip.ZipFile p_zip,
                               java.lang.String p_strRootDir,
                               java.io.File p_dirDst,
                               de.uplanet.util.Progress p_progress)
                        throws java.io.IOException
Copy a directory recursively from a ZIP file.
p_dirDst is the parent directory of the new directory.

Parameters:
p_zip - The file to be uzipped.
p_strRootDir - The root dir of the files in the zip, or null, if top level.
p_dirDst - The destination directory.
p_progress - The progress callback to be used. May be null.
Returns:
true, if this method created any files or directories, false otherwise
Throws:
java.io.IOException - If an I/O-error occurs.


Last updated: 2011-08-11 10-04
Copyright © 2000-2011 United Planet. All Rights Reserved.