com.cloudbees.utils
Class ZipHelper

java.lang.Object
  extended by com.cloudbees.utils.ZipHelper

public class ZipHelper
extends Object


Nested Class Summary
static interface ZipHelper.ZipEntryHandler
           
 
Constructor Summary
ZipHelper()
           
 
Method Summary
static void addDirectoryToZip(File directory, File base, String dirPrefix, ZipOutputStream zos)
          Recursively inserts all files in a directory into a zipstream.
static File unzipEntryToFolder(ZipEntry entry, InputStream zis, File destFolder)
           
static void unzipFile(InputStream fis, ZipHelper.ZipEntryHandler zipHandler, boolean closeStream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipHelper

public ZipHelper()
Method Detail

addDirectoryToZip

public static final void addDirectoryToZip(File directory,
                                           File base,
                                           String dirPrefix,
                                           ZipOutputStream zos)
                                    throws IOException
Recursively inserts all files in a directory into a zipstream.

Parameters:
directory - the source directory
base - optional parent directory that should serve as the entry root. Only path info after this base will be included as part of the entry name. By default, the directory parameter serves as root.
dirPrefix - optional directory prefix to prepend onto each entry name.
zos - the zip stream to add the files to.
Throws:
IOException

unzipFile

public static void unzipFile(InputStream fis,
                             ZipHelper.ZipEntryHandler zipHandler,
                             boolean closeStream)
                      throws IOException
Throws:
IOException

unzipEntryToFolder

public static File unzipEntryToFolder(ZipEntry entry,
                                      InputStream zis,
                                      File destFolder)
                               throws IOException
Throws:
IOException


Copyright © 2011. All Rights Reserved.