org.objectweb.cjdbc.common.util
Class ZipMe

java.lang.Object
  extended byorg.objectweb.cjdbc.common.util.ZipMe

public class ZipMe
extends java.lang.Object

Zip utility class inspired by the java tutorials of sun.

Author:
Nicolas Modrzyk

Field Summary
(package private) static int BUFFER
           
private  java.io.BufferedOutputStream dest
           
private  java.io.FileInputStream fis
           
private  java.io.FileOutputStream fos
           
(package private) static Trace logger
           
private  java.lang.String rootDir
           
(package private) static int STORE_FULL_PATH_IN_ZIP
           
(package private) static int STORE_NAME_ONLY_IN_ZIP
           
(package private) static int STORE_PATH_FROM_ZIP_ROOT
           
(package private) static int STORE_POLICY
           
(package private) static int STORE_RELATIVE_PATH_IN_ZIP
           
private  boolean useCompression
           
private  java.lang.String zipPath
           
private  java.util.zip.ZipInputStream zis
           
private  java.util.zip.ZipOutputStream zos
           
 
Constructor Summary
ZipMe()
          New ZipMe object
 
Method Summary
 void create(java.lang.String zipname, java.lang.String rootdir)
          Create a zip file from directory
 void create(java.lang.String zipname, java.lang.String rootdir, java.lang.String putMeThere)
          Same as above but the place where to put the zip file is explicit
private  void dirFunc(java.lang.String dirName)
           
 void expand(java.lang.String zipname, java.lang.String targetdir)
          Expand the content of the zip file
 void expand(java.lang.String zipname, java.lang.String targetdir, java.lang.String getMeThere)
          Same as below but the place where to get the zip file is explicit
 boolean getUseCompression()
           
 long getZipSize()
          Get the size of the zip file
 void setUseCompression(boolean useCompression)
           
private  void zipFunc(java.lang.String filePath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fos

private java.io.FileOutputStream fos

zos

private java.util.zip.ZipOutputStream zos

zis

private java.util.zip.ZipInputStream zis

fis

private java.io.FileInputStream fis

dest

private java.io.BufferedOutputStream dest

rootDir

private java.lang.String rootDir

zipPath

private java.lang.String zipPath

useCompression

private boolean useCompression

BUFFER

static final int BUFFER
See Also:
Constant Field Values

STORE_FULL_PATH_IN_ZIP

static final int STORE_FULL_PATH_IN_ZIP
See Also:
Constant Field Values

STORE_NAME_ONLY_IN_ZIP

static final int STORE_NAME_ONLY_IN_ZIP
See Also:
Constant Field Values

STORE_RELATIVE_PATH_IN_ZIP

static final int STORE_RELATIVE_PATH_IN_ZIP
See Also:
Constant Field Values

STORE_PATH_FROM_ZIP_ROOT

static final int STORE_PATH_FROM_ZIP_ROOT
See Also:
Constant Field Values

STORE_POLICY

static final int STORE_POLICY
See Also:
Constant Field Values

logger

static Trace logger
Constructor Detail

ZipMe

public ZipMe()
New ZipMe object

Method Detail

create

public void create(java.lang.String zipname,
                   java.lang.String rootdir)
            throws java.lang.Exception
Create a zip file from directory

Parameters:
zipname - of the file to create
rootdir - of the directory to archive
Throws:
java.lang.Exception - if fails

create

public void create(java.lang.String zipname,
                   java.lang.String rootdir,
                   java.lang.String putMeThere)
            throws java.lang.Exception
Same as above but the place where to put the zip file is explicit

Parameters:
zipname - of the file to create
rootdir - of the directory to archive
putMeThere - please
Throws:
java.lang.Exception - if fails

expand

public void expand(java.lang.String zipname,
                   java.lang.String targetdir,
                   java.lang.String getMeThere)
            throws java.lang.Exception
Same as below but the place where to get the zip file is explicit

Parameters:
zipname - of the file to expand
targetdir - where to place unzipped files
getMeThere - please
Throws:
java.lang.Exception - if fails

getZipSize

public long getZipSize()
Get the size of the zip file

Returns:
size in bytes

expand

public void expand(java.lang.String zipname,
                   java.lang.String targetdir)
            throws java.lang.Exception
Expand the content of the zip file

Parameters:
zipname - of the file to expand
targetdir - where to place unzipped files
Throws:
java.lang.Exception - if fails

dirFunc

private void dirFunc(java.lang.String dirName)
              throws java.io.IOException
Throws:
java.io.IOException

zipFunc

private void zipFunc(java.lang.String filePath)
              throws java.io.IOException
Throws:
java.io.IOException

getUseCompression

public boolean getUseCompression()
Returns:
Returns the useCompression.

setUseCompression

public void setUseCompression(boolean useCompression)
Parameters:
useCompression - The useCompression to set.


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.