public interface ZipUtilsService
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ZipUtilsService.FileFilter |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.Object |
DIRECTORY_MARKER
Marks a directory for zipping.
|
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
cleanDirectoryName(java.lang.String dirname)
Replaces invalid characters from a directory name to be zipped with valid
characters.
|
java.lang.String |
cleanFilename(java.lang.String filename)
Replaces invalid characters from a filename to be zipped with valid
characters.
|
void |
createZip(byte[] content,
java.io.OutputStream os) |
void |
createZip(FileServerFolder folder,
java.io.OutputStream os) |
void |
createZip(FileServerFolder folder,
java.io.OutputStream os,
ZipUtilsService.FileFilter filter) |
void |
createZip(java.util.List<java.nio.file.Path> files,
java.io.OutputStream os) |
void |
createZip(java.util.Map<java.lang.String,? extends java.lang.Object> content,
java.io.OutputStream os)
Packs the given list of files and/or directories into a zip archive.
|
void |
createZip(java.lang.String contentFilename,
java.lang.Object content,
java.io.OutputStream os)
Packs the given content into a zip archive.
|
void |
createZipFromEmailAttachments(java.util.List<SimpleAttachment> attachments,
java.io.OutputStream os) |
void |
extractZip(byte[] data,
ZipExtractionConfig config) |
void |
extractZip(java.io.InputStream is,
ZipExtractionConfig config) |
static final java.lang.Object DIRECTORY_MARKER
void createZip(java.util.Map<java.lang.String,? extends java.lang.Object> content,
java.io.OutputStream os)
throws java.io.IOException
content - map containing the files to zip. In case of zipping files, the
key contains the filename, while the value contains the object
to be zipped. The object may be a String or a byte array. In
case of zipping directories, the key contains the relative
directory path, and the value contains
DIRECTORY_MARKER. In this case, the files inside the
given directory should contain the relative path to the file.
Example zipping c.txt and mydirectory containing a.txt and
b.txt:
DIRECTORY_MARKERos - the OutputStream where the zip should be written tojava.io.IOException - if an I/O error has occurredvoid createZip(java.lang.String contentFilename,
java.lang.Object content,
java.io.OutputStream os)
throws java.io.IOException
contentFilename - the filename of the file to be zippedcontent - the content to be zipped. It may be a String or a byte
arrayos - the OutputStream where the zip should be written tojava.io.IOException - if an I/O error has occurredjava.lang.String cleanFilename(java.lang.String filename)
filename - the filename to be cleanedjava.lang.String cleanDirectoryName(java.lang.String dirname)
dirname - the directory name to be cleanedvoid createZip(java.util.List<java.nio.file.Path> files,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionvoid createZipFromEmailAttachments(java.util.List<SimpleAttachment> attachments, java.io.OutputStream os) throws java.io.IOException
java.io.IOExceptionvoid extractZip(byte[] data,
ZipExtractionConfig config)
throws java.io.IOException
java.io.IOExceptionvoid extractZip(java.io.InputStream is,
ZipExtractionConfig config)
throws java.io.IOException
java.io.IOExceptionvoid createZip(byte[] content,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionvoid createZip(FileServerFolder folder, java.io.OutputStream os) throws java.io.IOException
java.io.IOExceptionvoid createZip(FileServerFolder folder, java.io.OutputStream os, ZipUtilsService.FileFilter filter) throws java.io.IOException
java.io.IOException