|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object dk.netarkivet.common.utils.ZipUtils
public class ZipUtils
Utilities for interfacing with the (fairly low-level) java.util.zip package
Field Summary | |
---|---|
static java.lang.String |
GZIP_SUFFIX
The standard suffix for a gzipped file. |
Constructor Summary | |
---|---|
ZipUtils()
|
Method Summary | |
---|---|
static void |
gunzipFile(java.io.File fromFile,
java.io.File toFile)
Gunzip a single gzipped file into the given file. |
static void |
gunzipFiles(java.io.File fromDir,
java.io.File toDir)
Gunzip all .gz files in a given directory into another. |
static void |
gzipFiles(java.io.File fromDir,
java.io.File toDir)
GZip each of the files in fromDir, placing the result in toDir (which will be created) with names having .gz appended. |
static void |
unzip(java.io.File zipFile,
java.io.File toDir)
Unzip a zipFile into a directory. |
static void |
zipDirectory(java.io.File dir,
java.io.File into)
Zip the contents of a directory into a file. |
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 GZIP_SUFFIX
Constructor Detail |
---|
public ZipUtils()
Method Detail |
---|
public static void zipDirectory(java.io.File dir, java.io.File into)
dir
- The directory to zip.into
- The (zip) file to create. The name should typically end
in .zip, but that is not required.public static void unzip(java.io.File zipFile, java.io.File toDir)
zipFile
- The file to unziptoDir
- The directory to create the files under. This directory
will be created if necessary. Files in it will be overwritten if the
filenames match.public static void gzipFiles(java.io.File fromDir, java.io.File toDir)
fromDir
- An existing directorytoDir
- A directory where gzipped files will be placed. This
directory must not previously exist.
If the operation is not successfull, the directory will not be created.public static void gunzipFiles(java.io.File fromDir, java.io.File toDir)
fromDir
- The directory containing .gz filestoDir
- The directory to place the unzipped files in. This
directory must not exist beforehand.
IOFailure
- if there are problems creating the output directory
or gunzipping the files.public static void gunzipFile(java.io.File fromFile, java.io.File toFile)
fromFile
- A gzipped file to unzip.toFile
- The file that the contents of fromFile should be gunzipped
into. This file must be in an existing directory. Existing contents of
this file will be overwritten.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |