public class ZipUtils extends Object
Constructor and Description |
---|
ZipUtils() |
Modifier and Type | Method and Description |
---|---|
static InputStream |
streamForZipFileEntry(File zipFile,
String entryName)
Retrieves an input stream reading from a named entry in a zip file.
|
static void |
unzip(File input,
File outputDir)
Expand a Zip file into a directory.
|
static void |
zip(File inputDir,
File output)
Zip a directory into a file.
|
public static InputStream streamForZipFileEntry(File zipFile, String entryName) throws IOException
zipFile
- the path to the zip file.entryName
- the name of the entry to which an input stream should be returned.IOException
- if the zip file is unreadable, or if it does not contained the named entry.public static void zip(File inputDir, File output) throws IOException
inputDir
- Directory to be compressed.output
- Target file for the zip contents. If the file exists it will be overwritten.FileNotFoundException
- if source does not existIOException
- For other IO errorspublic static void unzip(File input, File outputDir) throws IOException
input
- Zip file to be expandedoutputDir
- Target directory. Files will be overwrittenFileNotFoundException
- if source does not existIOException
- For other IO errorsCopyright © 2002-2023 Atlassian. All Rights Reserved.