wt.step
Class ZipStepPackager

java.lang.Object
  extended bywt.step.StepPackager
      extended bywt.step.ZipStepPackager

public class ZipStepPackager
extends StepPackager

StepPackage generator using the Zip format.


Field Summary
 
Fields inherited from class wt.step.StepPackager
WRITE_BUFFER_SIZE
 
Constructor Summary
ZipStepPackager()
           
 
Method Summary
 void createPackage(File zipFile, File contentDir, boolean includeDirectory, boolean deleteAsAdded)
          Zip up a directory in to a single zip file
 void extractPackage(InputStream istream, File baseDir)
           
 String getPackageFileExtension()
           
private  Vector listContents(InputStream zipFile, boolean ignoreDirectories)
          Lists the names of all Zip Entries in a 'zip' stream.
 String[] listPackageContents(InputStream istream, boolean ignoreDirectories)
           
private  void writeDirectoryContent(ZipOutputStream ostream, int rootPathIndex, File contentDir, boolean deleteAsAdded)
           
 
Methods inherited from class wt.step.StepPackager
getPackagerInstance
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZipStepPackager

public ZipStepPackager()
Method Detail

getPackageFileExtension

public String getPackageFileExtension()
Specified by:
getPackageFileExtension in class StepPackager

createPackage

public void createPackage(File zipFile,
                          File contentDir,
                          boolean includeDirectory,
                          boolean deleteAsAdded)
                   throws FileNotFoundException,
                          IOException
Zip up a directory in to a single zip file

Specified by:
createPackage in class StepPackager
Parameters:
includeDirectory - If true then the given directory is also added to the zip file and all files are rooted from that directory.
deleteAsAdded - Delete files so that they are 'moved' into the zip file.
Throws:
FileNotFoundException
IOException

writeDirectoryContent

private void writeDirectoryContent(ZipOutputStream ostream,
                                   int rootPathIndex,
                                   File contentDir,
                                   boolean deleteAsAdded)
                            throws FileNotFoundException,
                                   IOException
Throws:
FileNotFoundException
IOException

listPackageContents

public String[] listPackageContents(InputStream istream,
                                    boolean ignoreDirectories)
                             throws IOException
Specified by:
listPackageContents in class StepPackager
Throws:
IOException

listContents

private Vector listContents(InputStream zipFile,
                            boolean ignoreDirectories)
                     throws ZipException,
                            IOException
Lists the names of all Zip Entries in a 'zip' stream.

Throws:
ZipException
IOException

extractPackage

public void extractPackage(InputStream istream,
                           File baseDir)
                    throws IOException,
                           FileNotFoundException
Specified by:
extractPackage in class StepPackager
Throws:
IOException
FileNotFoundException