org.ow2.petals.microkernel.api.util
Class ZipUtil

java.lang.Object
  extended by org.ow2.petals.microkernel.api.util.ZipUtil

public final class ZipUtil
extends Object

Contains utilities methods in relation to Zip operations.

Author:
Rafael Marins - Fossil E-Commerce, ddesjardins - EBM WebSourcing, Olivier Fabre - EBM WebSourcing

Method Summary
static File getEntryAsTemp(ZipFile zipFile, String entryName)
          Create a temporary File from a given entry of a given ZipFile.
static void unzipArchive(File zipFile, File destDir)
          Unzip given zip file into the given destination
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getEntryAsTemp

public static File getEntryAsTemp(ZipFile zipFile,
                                  String entryName)
                           throws org.ow2.petals.basisapi.exception.PetalsException,
                                  IOException
Create a temporary File from a given entry of a given ZipFile. You must delete the temp file after using it.

Parameters:
zipFile - the Zipped file to search in, must be non null
entryName - the name of an entry in the Zip file, must be non null and non empty
Returns:
a temp File read from the Zip entry, not null.
Throws:
org.ow2.petals.basisapi.exception.PetalsException - if entry can't be found or if an error occured during zip reading
IOException

unzipArchive

public static void unzipArchive(File zipFile,
                                File destDir)
                         throws IOException
Unzip given zip file into the given destination

Parameters:
zipFile - the File to unzip, cannot be null
destDir - the destination directory, can be null
Throws:
IOException - if an I/O error occurred


Copyright © 2005-2015 Linagora. All Rights Reserved.