org.eclipse.actf.util.jar
Class ZipImploder

java.lang.Object
  extended by org.eclipse.actf.util.jar.ZipImploder

public class ZipImploder
extends Object

Author:
Barry Feigenbaum

Field Summary
protected  String baseDir
           
protected  int dirCount
           
protected  int fileCount
           
protected  boolean includeDirs
           
protected  Manifest manifest
           
protected  boolean verbose
           
 
Constructor Summary
ZipImploder()
          create a new imploder with no verbosity
ZipImploder(boolean verbose)
          create a new imploder with the specified verbosity state
 
Method Summary
protected  void configure(ZipOutputStream zos, String comment, int method, int level)
           
protected  void copyFileEntry(ZipOutputStream zos, DataInputStream dis)
           
protected  void copyFileEntry(ZipOutputStream zos, File f)
           
 String getBaseDir()
           
 int getDirCount()
           
 int getFileCount()
           
 boolean getIncludeDirs()
          returns whether or not path information is included in .zip
 Manifest getManifest()
           
 boolean getVerbose()
          get the verbose mode
static void main(String[] args)
          Main command line entry point.
protected  void print(String s)
           
static void printHelp()
          Print command help text.
 void process(String zipName, String jarName, String sourceDir)
          implode source directory into .jar/.zip file
protected  void process(ZipOutputStream zos, File dir)
           
 void processDir(ZipOutputStream zos, File dir)
           
 void processFile(ZipOutputStream zos, File f)
          process a single file for a .zip file
 void processJar(String jarName, String sourceDir)
          Implode target JAR file from a source directory
 void processJar(String jarName, String sourceDir, String comment)
          Implode target JAR file from a source directory
 void processJar(String jarName, String sourceDir, String comment, int method, int level)
          Implode target JAR file from a source directory
 void processZip(String zipName, String sourceDir)
          Implode target JAR file from a source directory
 void processZip(String zipName, String sourceDir, String comment)
          Implode target zip file from a source directory
 void processZip(String zipName, String sourceDir, String comment, int method, int level)
          Implode target zip file from a source directory
protected  byte[] readAllBytes(DataInputStream is)
          Read all the bytes in a stream
protected  String removeDrive(String path)
           
protected  String removeLead(String path)
           
protected static void reportError(String msg)
           
 void setBaseDir(String baseDir)
           
 void setIncludeDirs(boolean includeDirs)
          set whether or not path information is included in .zip files
 void setManifest(Manifest manifest)
           
protected  String setup(String zipName, String sourceDir)
           
 void setVerbose(boolean f)
          set the verbosity mode
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dirCount

protected int dirCount

fileCount

protected int fileCount

verbose

protected boolean verbose

baseDir

protected String baseDir

manifest

protected Manifest manifest

includeDirs

protected boolean includeDirs
Constructor Detail

ZipImploder

public ZipImploder()
create a new imploder with no verbosity


ZipImploder

public ZipImploder(boolean verbose)
create a new imploder with the specified verbosity state

Parameters:
verbose - - verbosity state
Method Detail

getDirCount

public int getDirCount()
Returns:
Returns the dirCount.

getFileCount

public int getFileCount()
Returns:
Returns the fileCount.

getVerbose

public boolean getVerbose()
get the verbose mode

Returns:
verbosity mode

setVerbose

public void setVerbose(boolean f)
set the verbosity mode

Parameters:
f - verbosity state

getBaseDir

public String getBaseDir()
Returns:
Returns the baseDir.

setBaseDir

public void setBaseDir(String baseDir)
                throws IOException
Parameters:
baseDir - The baseDir to set.
Throws:
IOException

getManifest

public Manifest getManifest()
Returns:
Returns the manifest

setManifest

public void setManifest(Manifest manifest)
Parameters:
manifest - The manifest to set.

getIncludeDirs

public boolean getIncludeDirs()
returns whether or not path information is included in .zip

Returns:
true if path information is included, false otherwise

setIncludeDirs

public void setIncludeDirs(boolean includeDirs)
set whether or not path information is included in .zip files

Parameters:
includeDirs - include path inforamtion in .zip file

process

public void process(String zipName,
                    String jarName,
                    String sourceDir)
             throws IOException
implode source directory into .jar/.zip file

Parameters:
zipName - name of target file
jarName - name of target file
sourceDir - source directory name
Throws:
IOException - error creating a target file

processJar

public void processJar(String jarName,
                       String sourceDir)
                throws IOException
Implode target JAR file from a source directory

Parameters:
jarName - name of target file
sourceDir - source directory name
Throws:
IOException - error creating a target file

processJar

public void processJar(String jarName,
                       String sourceDir,
                       String comment)
                throws IOException
Implode target JAR file from a source directory

Parameters:
jarName - name of target file
sourceDir - source directory name (
comment -
Throws:
IOException - error creating a target file

processJar

public void processJar(String jarName,
                       String sourceDir,
                       String comment,
                       int method,
                       int level)
                throws IOException
Implode target JAR file from a source directory

Parameters:
jarName - - name of target .jar
sourceDir - - source directory
comment - - comment for .jar file
method -
level -
Throws:
IOException

processZip

public void processZip(String zipName,
                       String sourceDir)
                throws IOException
Implode target JAR file from a source directory

Parameters:
zipName - name of target file
sourceDir - source directory name (
Throws:
IOException - error creating a target file

processZip

public void processZip(String zipName,
                       String sourceDir,
                       String comment)
                throws IOException
Implode target zip file from a source directory

Parameters:
zipName -
sourceDir -
comment -
Throws:
IOException

processZip

public void processZip(String zipName,
                       String sourceDir,
                       String comment,
                       int method,
                       int level)
                throws IOException
Implode target zip file from a source directory

Parameters:
zipName -
sourceDir -
comment -
method -
level -
Throws:
IOException

configure

protected void configure(ZipOutputStream zos,
                         String comment,
                         int method,
                         int level)

setup

protected String setup(String zipName,
                       String sourceDir)
                throws IOException
Throws:
IOException

process

protected void process(ZipOutputStream zos,
                       File dir)
                throws IOException
Throws:
IOException

removeDrive

protected String removeDrive(String path)

removeLead

protected String removeLead(String path)

processDir

public void processDir(ZipOutputStream zos,
                       File dir)
                throws IOException
Throws:
IOException

processFile

public void processFile(ZipOutputStream zos,
                        File f)
                 throws IOException
process a single file for a .zip file

Parameters:
zos -
f -
Throws:
IOException

copyFileEntry

protected void copyFileEntry(ZipOutputStream zos,
                             File f)
                      throws IOException
Throws:
IOException

copyFileEntry

protected void copyFileEntry(ZipOutputStream zos,
                             DataInputStream dis)
                      throws IOException
Throws:
IOException

readAllBytes

protected byte[] readAllBytes(DataInputStream is)
                       throws IOException
Read all the bytes in a stream

Throws:
IOException

print

protected void print(String s)

printHelp

public static void printHelp()
Print command help text.


reportError

protected static void reportError(String msg)

main

public static void main(String[] args)
Main command line entry point.

Parameters:
args -