public class ZipUtilsServiceImpl extends java.lang.Object implements ZipUtilsService
ZipUtilsService.FileFilterDIRECTORY_MARKER| Constructor and Description |
|---|
ZipUtilsServiceImpl() |
| 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) |
void |
zipDirectory(java.io.File dir,
java.io.OutputStream os) |
public void createZip(byte[] content,
java.io.OutputStream os)
throws java.io.IOException
createZip in interface ZipUtilsServicejava.io.IOExceptionpublic void createZip(java.util.Map<java.lang.String,? extends java.lang.Object> content,
java.io.OutputStream os)
throws java.io.IOException
ZipUtilsServicecreateZip in interface ZipUtilsServicecontent - 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 occurredpublic void createZip(java.lang.String contentFilename,
java.lang.Object content,
java.io.OutputStream os)
throws java.io.IOException
ZipUtilsServicecreateZip in interface ZipUtilsServicecontentFilename - 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 occurredpublic void createZip(java.util.List<java.nio.file.Path> files,
java.io.OutputStream os)
throws java.io.IOException
createZip in interface ZipUtilsServicejava.io.IOExceptionpublic void createZipFromEmailAttachments(java.util.List<SimpleAttachment> attachments, java.io.OutputStream os) throws java.io.IOException
createZipFromEmailAttachments in interface ZipUtilsServicejava.io.IOExceptionpublic void zipDirectory(java.io.File dir,
java.io.OutputStream os)
throws java.io.IOException
java.io.IOExceptionpublic void extractZip(byte[] data,
ZipExtractionConfig config)
throws java.io.IOException
extractZip in interface ZipUtilsServicejava.io.IOExceptionpublic void extractZip(java.io.InputStream is,
ZipExtractionConfig config)
throws java.io.IOException
extractZip in interface ZipUtilsServicejava.io.IOExceptionpublic void createZip(FileServerFolder folder, java.io.OutputStream os) throws java.io.IOException
createZip in interface ZipUtilsServicejava.io.IOExceptionpublic void createZip(FileServerFolder folder, java.io.OutputStream os, ZipUtilsService.FileFilter filter) throws java.io.IOException
createZip in interface ZipUtilsServicejava.io.IOExceptionpublic java.lang.String cleanFilename(java.lang.String filename)
ZipUtilsServicecleanFilename in interface ZipUtilsServicefilename - the filename to be cleanedpublic java.lang.String cleanDirectoryName(java.lang.String dirname)
ZipUtilsServicecleanDirectoryName in interface ZipUtilsServicedirname - the directory name to be cleaned