it.geosolutions.tools.compress.file
Class Extractor

java.lang.Object
  extended by it.geosolutions.tools.compress.file.Extractor

public final class Extractor
extends Object

A Class container for Extractors methods.

Author:
Carlo Cancellieri - carlo.cancellieri@geo-solutions.it

Constructor Summary
Extractor()
           
 
Method Summary
static void extractBz2(File in_file, File out_file)
           
static void extractGzip(File in_file, File out_file)
           
static void inflate(ZipFile archive, File outputDirectory, String fileName)
          Inflate the provided ZipFile in the provided output directory.
static void unZip(File inputZipFile, File outputDir)
           
static void unZip(String inputZipName, String outputDirName)
           
static List<File> unzipFlat(File zipFile, File destDir)
          Deprecated. use Extractor.unZip instead which support complex zip structure
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Extractor

public Extractor()
Method Detail

unzipFlat

public static List<File> unzipFlat(File zipFile,
                                   File destDir)
Deprecated. use Extractor.unZip instead which support complex zip structure

Unzips the files from a zipfile into a directory. All of the files will be put in a single direcotry. If the zipfile contains a hierarchycal structure, it will be ignored.

Parameters:
zipFile - The zipfile to be examined
destDir - The direcotry where the extracted files will be stored.
Returns:
The list of the extracted files, or null if an error occurred.
Throws:
IllegalArgumentException - if the destination dir is not writeable.

unZip

public static void unZip(String inputZipName,
                         String outputDirName)
                  throws IOException,
                         org.apache.commons.compress.compressors.CompressorException
Parameters:
inputZipName - - the input zip file
outputDirName - - a directory with this name containing zip files will be created
Throws:
IOException
org.apache.commons.compress.compressors.CompressorException

unZip

public static void unZip(File inputZipFile,
                         File outputDir)
                  throws IOException,
                         org.apache.commons.compress.compressors.CompressorException
Throws:
IOException
org.apache.commons.compress.compressors.CompressorException

extractBz2

public static void extractBz2(File in_file,
                              File out_file)
                       throws org.apache.commons.compress.compressors.CompressorException
Throws:
org.apache.commons.compress.compressors.CompressorException

extractGzip

public static void extractGzip(File in_file,
                               File out_file)
                        throws org.apache.commons.compress.compressors.CompressorException
Parameters:
in_file - the input bz2 file to extract
out_file - the output tar file to extract to
Throws:
org.apache.commons.compress.compressors.CompressorException

inflate

public static void inflate(ZipFile archive,
                           File outputDirectory,
                           String fileName)
                    throws IOException,
                           FileNotFoundException
Inflate the provided ZipFile in the provided output directory.

Parameters:
archive - the ZipFile to inflate.
outputDirectory - the directory where to inflate the archive.
Throws:
IOException - in case something bad happens.
FileNotFoundException - in case something bad happens.


Copyright © 2011-2012 GeoSolutions. All Rights Reserved.