org.ops4j.io
Class ZipExploder

java.lang.Object
  extended by org.ops4j.io.ZipExploder

public class ZipExploder
extends Object

class for exploding jar/zip files onto the file system

Author:
Barry Feigenbaum

Field Summary
protected  boolean sortNames
           
protected  boolean verbose
           
 
Constructor Summary
ZipExploder()
          create a zip exploder for unpacking .jar/.zip files
ZipExploder(boolean verbose)
          create a zip exploder for unpacking .jar/.zip files onto the file system
ZipExploder(boolean verbose, boolean sorted)
          create a zip exploder for unpacking .jar/.zip files onto the file system
 
Method Summary
protected  void copyFileEntry(String destDir, boolean destIsDir, String destFile, DataInputStream dis)
           
 void copyFileEntry(String destDir, ZipFile zf, ZipEntry ze)
          copy a single entry from the archive
protected  Map<String,ZipEntry> getEntries(ZipFile zf)
          Get all the entries in a ZIP file.
 boolean getSortNames()
           
 boolean getVerbose()
          Get the verbose mode state.
static void main(String[] args)
          Main command line entry point.
protected  void print(String s)
           
protected static void printHelp()
          Print command help text.
 void process(String[] zipNames, String[] jarNames, String destDir)
          Explode source JAR and/or ZIP files into a target directory
 void processFile(String zipName, String destDir)
          Explode source ZIP or JAR file into a target directory
 void processJars(String[] jarNames, String destDir)
          Explode source JAR files into a target directory
 void processZips(String[] zipNames, String destDir)
          Explode source ZIP files into a target directory
protected  byte[] readAllBytes(DataInputStream is)
          Read all the bytes in a ZIPed file
protected static void reportError(String msg)
           
 void setSortNames(boolean sortNames)
           
 void setVerbose(boolean f)
          set the verbose mode state
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verbose

protected boolean verbose

sortNames

protected boolean sortNames
Constructor Detail

ZipExploder

public ZipExploder()
create a zip exploder for unpacking .jar/.zip files


ZipExploder

public ZipExploder(boolean verbose)
create a zip exploder for unpacking .jar/.zip files onto the file system

Parameters:
verbose - - set to true for verbose mode

ZipExploder

public ZipExploder(boolean verbose,
                   boolean sorted)
create a zip exploder for unpacking .jar/.zip files onto the file system

Parameters:
verbose - - set to true for verbose mode
sorted - - set to true for sorted file mode
Method Detail

getVerbose

public boolean getVerbose()
Get the verbose mode state.

Returns:
verbosity

setVerbose

public void setVerbose(boolean f)
set the verbose mode state

Parameters:
f - - verbosity

getSortNames

public boolean getSortNames()
Returns:
Returns the sortNames.

setSortNames

public void setSortNames(boolean sortNames)
Parameters:
sortNames - The sortNames to set.

process

public void process(String[] zipNames,
                    String[] jarNames,
                    String destDir)
             throws IOException
Explode source JAR and/or ZIP files into a target directory

Parameters:
zipNames - names of source files
jarNames - names of source files
destDir - target directory name (should already exist)
Throws:
IOException - error creating a target file

processJars

public void processJars(String[] jarNames,
                        String destDir)
                 throws IOException
Explode source JAR files into a target directory

Parameters:
jarNames - names of source files
destDir - target directory name (should already exist)
Throws:
IOException - error creating a target file

processZips

public void processZips(String[] zipNames,
                        String destDir)
                 throws IOException
Explode source ZIP files into a target directory

Parameters:
zipNames - names of source files
destDir - target directory name (should already exist)
Throws:
IOException - error creating a target file

processFile

public void processFile(String zipName,
                        String destDir)
                 throws IOException
Explode source ZIP or JAR file into a target directory

Parameters:
zipName - names of source file
destDir - target directory name (should already exist)
Throws:
IOException - error creating a target file

getEntries

protected Map<String,ZipEntry> getEntries(ZipFile zf)
Get all the entries in a ZIP file.


copyFileEntry

public void copyFileEntry(String destDir,
                          ZipFile zf,
                          ZipEntry ze)
                   throws IOException
copy a single entry from the archive

Parameters:
destDir -
zf -
ze -
Throws:
IOException

copyFileEntry

protected void copyFileEntry(String destDir,
                             boolean destIsDir,
                             String destFile,
                             DataInputStream dis)
                      throws IOException
Throws:
IOException

readAllBytes

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

Throws:
IOException

print

protected void print(String s)

printHelp

protected 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 -


Copyright © 2006-2013 OPS4J - Open Participation Software for Java. All Rights Reserved.