gov.nih.nci.caarray.services.util.file
Class ZipUtil

java.lang.Object
  extended by gov.nih.nci.caarray.services.util.file.ZipUtil

public class ZipUtil
extends java.lang.Object


Constructor Summary
ZipUtil()
           
 
Method Summary
static java.lang.String getFilename(java.io.File file, int entryIndex)
          Returns the file name (with no path) for the Zip entry at the index given.
static void unzip(java.io.File zipFile, java.io.File unzippedFile)
          Unzips the first file in the zip file provided to the destination provided.
static void unzip(java.io.InputStream inputStream, java.io.File unzippedFile)
          Unzips the first file in the zip strean provided to the destination provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipUtil

public ZipUtil()
Method Detail

unzip

public static void unzip(java.io.File zipFile,
                         java.io.File unzippedFile)
                  throws java.io.IOException
Unzips the first file in the zip file provided to the destination provided.

Parameters:
zipFile - the file to unzip.
unzippedFile - destination for the unzipped file.
Throws:
java.io.IOException - if an error occurred unzipping.

unzip

public static void unzip(java.io.InputStream inputStream,
                         java.io.File unzippedFile)
                  throws java.io.IOException
Unzips the first file in the zip strean provided to the destination provided.

Parameters:
inputStream - input stream containing zip content.
unzippedFile - destination for the unzipped file.
Throws:
java.io.IOException - if an error occurred unzipping.

getFilename

public static java.lang.String getFilename(java.io.File file,
                                           int entryIndex)
Returns the file name (with no path) for the Zip entry at the index given.

Parameters:
zipFile - get file name from this zip file
entryIndex - get file name for this entry
Returns:
the filename