|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.core.util.zip.ZipArchiver
@NotThreadSafe public class ZipArchiver
An utility class which allows to add multiple directories/files/entries from stream to zip archive.
| Constructor Summary | |
|---|---|
ZipArchiver(File archiveFile)
|
|
| Method Summary | |
|---|---|
void |
addEntry(InputStream content,
String entryPath)
Adds new entry to zip archive with name specified by entryPath parameter and with content from provided
InputStream |
void |
addFile(File sourceFile,
String targetPath)
Adds a file to archive. |
void |
addFolder(File folderToCompress,
ArchiveParams archiveParams)
Adds directory and all subdirectories into archive. |
void |
addFolder(File folderToCompress,
String archiveFolderName)
Adds directory and all subdirectories into archive. |
OutputStream |
addNextEntry(String entryName)
Creates new zipEntry and provides OutputStream to write content to given entry. |
void |
close()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ZipArchiver(File archiveFile)
| Method Detail |
|---|
public void addFolder(File folderToCompress,
String archiveFolderName)
throws IOException
folderToCompress - the directory handle to add to archivearchiveFolderName - the name which will be used as archive directory name, for example when folderToCompress is pointing into /home/A/B directory which contains file with path
/home/A/B/C/file and archiveFolderName equals "archive" a result zip archive
will contain entry: /archive/C/file
IOException
public void addFolder(File folderToCompress,
ArchiveParams archiveParams)
throws IOException
folderToCompress - the directory handle to add to archivearchiveParams - parameters for the files in the folder to be added the to archive
IOException
public void addFile(File sourceFile,
String targetPath)
throws IOException
sourceFile - a file which content will be added as new entrytargetPath - a file path which will be used as entry name
IOException
public void addEntry(InputStream content,
String entryPath)
throws IOException
entryPath parameter and with content from provided
InputStream
content - stream which will be used as entry contententryPath - will be used as entry name
IOException
public OutputStream addNextEntry(String entryName)
throws IOException
entryName - the name of zip entry
IOException
public void close()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||