com.lightdev.app.trec.server
Class Extractor

java.lang.Object
  extended by com.lightdev.app.trec.server.Extractor

public class Extractor
extends Object

An extractor class can be used to extract ZIP and JAR files

Version:
2, 05.01.2006
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the BSD License, for details see file license.txt in the distribution package of this software

Constructor Summary
Extractor()
          create a new instance of an Extractor object
 
Method Summary
 boolean delete(File file, String destPath)
          delete files extracted through this class, given that extracted files were not moved Does not delete directories
 void extract(File file, String destPath)
          extract a given archive file to a given path
 void unzip(ZipFile zipfile, ZipEntry zipentry, String destPath)
          unzip a given entry of a given zip file to a given location
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Extractor

public Extractor()
create a new instance of an Extractor object

Method Detail

delete

public boolean delete(File file,
                      String destPath)
               throws ZipException,
                      IOException
delete files extracted through this class, given that extracted files were not moved

Does not delete directories

Parameters:
file - zip file
destPath - destination, zip file was extracted to
Returns:
true, when operation was successful
Throws:
ZipException
IOException

extract

public void extract(File file,
                    String destPath)
             throws ZipException,
                    IOException
extract a given archive file to a given path

Parameters:
file - the archive file to extract
destPath - the path to the destination location for the extracted content
Throws:
ZipException
IOException

unzip

public void unzip(ZipFile zipfile,
                  ZipEntry zipentry,
                  String destPath)
           throws IOException
unzip a given entry of a given zip file to a given location

Parameters:
zipfile - the zip file to read an entry from
zipentry - the zip entry to read
destPath - the path to the destination location for the extracted content
Throws:
IOException