|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.objectweb.cjdbc.common.util.Zipper
Zip utility class to compress a directory into a single zip file and vice-versa.
Field Summary | |
private static int |
BUFFER_SIZE
|
(package private) static Trace |
logger
|
static int |
STORE_FULL_PATH_IN_ZIP
Store full path in zip when archiving |
static int |
STORE_NAME_ONLY_IN_ZIP
Store only file names in zip when archiving |
static int |
STORE_PATH_FROM_ZIP_ROOT
Store path relative to root directory in zip when archiving |
static int |
STORE_RELATIVE_PATH_IN_ZIP
Store relative path in zip when archiving |
static java.lang.String |
ZIP_EXT
Extension for zipped file names |
Constructor Summary | |
Zipper()
|
Method Summary | |
private static void |
directoryWalker(java.lang.String currentDir,
java.lang.String rootDir,
java.util.zip.ZipOutputStream zos,
int storePolicy)
Walk through currentDir and recursively in its subdirectories. |
static void |
unzip(java.lang.String zipName,
java.lang.String targetDir)
Expand the content of the zip file |
static void |
zip(java.lang.String zipName,
java.lang.String rootDir,
int storePolicy)
Create a zip file from directory |
private static void |
zipFile(java.lang.String filePath,
java.util.zip.ZipOutputStream zos,
int storePolicy,
java.lang.String rootDir)
TODO: zipFunc definition. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String ZIP_EXT
private static final int BUFFER_SIZE
public static final int STORE_FULL_PATH_IN_ZIP
public static final int STORE_NAME_ONLY_IN_ZIP
public static final int STORE_RELATIVE_PATH_IN_ZIP
public static final int STORE_PATH_FROM_ZIP_ROOT
static Trace logger
Constructor Detail |
public Zipper()
Method Detail |
public static void zip(java.lang.String zipName, java.lang.String rootDir, int storePolicy) throws java.lang.Exception
zipName
- name of the file to createrootDir
- root directory to archivestorePolicy
- the store policy to use (STORE_FULL_PATH_IN_ZIP,
STORE_NAME_ONLY_IN_ZIP, STORE_RELATIVE_PATH_IN_ZIP or
STORE_PATH_FROM_ZIP_ROOT)
java.lang.Exception
- if failspublic static void unzip(java.lang.String zipName, java.lang.String targetDir) throws java.lang.Exception
zipName
- of the file to expandtargetDir
- where to place unzipped files
java.lang.Exception
- if failsprivate static void directoryWalker(java.lang.String currentDir, java.lang.String rootDir, java.util.zip.ZipOutputStream zos, int storePolicy) throws java.io.IOException
currentDir
- directory to walk throughrootDir
- root directory for path referenceszos
- ZipOutputSteam to write tostorePolicy
- file path storing policy
java.io.IOException
- if an error occursprivate static void zipFile(java.lang.String filePath, java.util.zip.ZipOutputStream zos, int storePolicy, java.lang.String rootDir) throws java.io.IOException
filePath
- file to compresszos
- ZipOutputSteam to write tostorePolicy
- file path storing policyrootDir
- root directory for path references
java.io.IOException
- if an error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |