public class ZipFileWriter extends Object implements Closeable
| Constructor and Description |
|---|
ZipFileWriter(String archivePath)
Creates an instance for zip file writing.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEntry(String fileName,
File file)
Add file from disk into zip archive.
|
void |
addEntry(String fileName,
InputStream inputStream)
Add file into zip archive with data from stream.
|
void |
addJsonEntry(String fileName,
Object objectToAdd)
Add file into zip archive with object serialized as JSON.
|
void |
close() |
public ZipFileWriter(String archivePath) throws IOException
archivePath - the path to the zip file to writeIOException - if some I/O exception occurspublic void addEntry(String fileName, File file) throws IOException
fileName - the target name of the file inside zip after writingfile - the path to the file on disk to archiveIOException - if some I/O exception occurspublic void addEntry(String fileName, InputStream inputStream) throws IOException
fileName - the target name of the file inside zip after writinginputStream - the input stream to archiveIOException - if some I/O exception occurspublic void addJsonEntry(String fileName, Object objectToAdd) throws IOException
fileName - the target name of the file inside zip after writingobjectToAdd - the object to serialize as JSONIOException - if some I/O exception occurspublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionCopyright © 1998–2022 iText Group NV. All rights reserved.