Class ZipCompressUtils
java.lang.Object
org.onehippo.forge.content.exim.repository.jaxrs.util.ZipCompressUtils
ZIP Compressing Utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
addEntryToZip
(String entryName, byte[] bytes, int offset, int length, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add a ZIP entry tozipOutput
with the givenentryName
andbytes
starting fromoffset
inlength
.static void
addEntryToZip
(String entryName, byte[] bytes, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add a ZIP entry tozipOutput
with the givenentryName
andbytes
.static void
addEntryToZip
(String entryName, String content, String charsetName, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add a ZIP entry tozipOutput
with the givenentryName
and stringcontent
incharsetName
encoding.static void
addFileEntriesInFolderToZip
(File baseFolder, String prefix, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add ZIP entries tozipOutput
by selecting all the descendant files under thebaseFolder
, starting with the ZIP entry nameprefix
.
-
Method Details
-
addEntryToZip
public static void addEntryToZip(String entryName, String content, String charsetName, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) throws IOException Add a ZIP entry tozipOutput
with the givenentryName
and stringcontent
incharsetName
encoding.- Parameters:
entryName
- ZIP entry namecontent
- string content of the ZIP entry.charsetName
- charset name in encodingzipOutput
- ZipArchiveOutputStream instance- Throws:
IOException
- if IO exception occurs
-
addEntryToZip
public static void addEntryToZip(String entryName, byte[] bytes, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) throws IOException Add a ZIP entry tozipOutput
with the givenentryName
andbytes
.- Parameters:
entryName
- ZIP entry namebytes
- the byte array to fill in for the ZIP entryzipOutput
- ZipArchiveOutputStream instance- Throws:
IOException
- if IO exception occurs
-
addEntryToZip
public static void addEntryToZip(String entryName, byte[] bytes, int offset, int length, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) throws IOException Add a ZIP entry tozipOutput
with the givenentryName
andbytes
starting fromoffset
inlength
.- Parameters:
entryName
- ZIP entry namebytes
- the byte array to fill in for the ZIP entryoffset
- the starting offset index to read from the byte arraylength
- the length to read from the byte arrayzipOutput
- ZipArchiveOutputStream instance- Throws:
IOException
- if IO exception occurs
-
addFileEntriesInFolderToZip
public static void addFileEntriesInFolderToZip(File baseFolder, String prefix, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) throws IOException Add ZIP entries tozipOutput
by selecting all the descendant files under thebaseFolder
, starting with the ZIP entry nameprefix
.- Parameters:
baseFolder
- base folder to find child files underneathprefix
- the prefix of ZIP entry namezipOutput
- ZipArchiveOutputStream instance- Throws:
IOException
- if IO exception occurs
-