public class ZipUtil extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ZipUtil.Packer |
Constructor and Description |
---|
ZipUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
unzip(File zipFile,
File destDir,
String selector)
Extracts the specified zip file to the specified location.
|
static byte[] |
unzip(InputStream in)
Returns the unzipped contents of the zipped input stream in a byte array
|
static byte[] |
zip(InputStream in)
Returns a byte array containing the gzipped contents of the input stream
|
public static void unzip(File zipFile, File destDir, String selector) throws IOException
selector
is specified,
then only the entry specified by selector
(if selector
is a filename) or the
contents of the directory specified by selector
(if selector
is a directory
name) will be extracted. If selector
specifies a directory, then the contents of the
directory in the zip file will be rooted at destDir
when extracted.zipFile
- the File
object for the file to unzipdestDir
- the File
object for the target directoryselector
- The name of a file or directory to extractIOException
public static byte[] zip(InputStream in) throws IOException
in
- the input stream to zipIOException
public static byte[] unzip(InputStream in) throws IOException
in
- the input stream to unzipIOException
Copyright © 2011-2015 IBM. All Rights Reserved.