Package com.atlassian.jira.util
Class ZipUtils
java.lang.Object
com.atlassian.jira.util.ZipUtils
Simple utility functions for dealing with zip files.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic InputStream
streamForZipFileEntry
(File zipFile, String entryName) Retrieves an input stream reading from a named entry in a zip file.static void
Expand a Zip file into a directory.static void
Zip a directory into a file.
-
Constructor Details
-
ZipUtils
public ZipUtils()
-
-
Method Details
-
streamForZipFileEntry
Retrieves an input stream reading from a named entry in a zip file.- Parameters:
zipFile
- the path to the zip file.entryName
- the name of the entry to which an input stream should be returned.- Returns:
- an input stream reading from the named entry in the specified file.
- Throws:
IOException
- if the zip file is unreadable, or if it does not contained the named entry.
-
zip
Zip a directory into a file.- Parameters:
inputDir
- Directory to be compressed.output
- Target file for the zip contents. If the file exists it will be overwritten.- Throws:
FileNotFoundException
- if source does not existIOException
- For other IO errors- Since:
- v6.2
-
unzip
Expand a Zip file into a directory.- Parameters:
input
- Zip file to be expandedoutputDir
- Target directory. Files will be overwritten- Throws:
FileNotFoundException
- if source does not existIOException
- For other IO errors- Since:
- v6.2
-