Class ZipCompressUtils
java.lang.Object
org.onehippo.forge.content.exim.repository.jaxrs.util.ZipCompressUtils
ZIP Compressing Utilities.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddEntryToZip(String entryName, byte[] bytes, int offset, int length, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add a ZIP entry tozipOutputwith the givenentryNameandbytesstarting fromoffsetinlength.static voidaddEntryToZip(String entryName, byte[] bytes, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add a ZIP entry tozipOutputwith the givenentryNameandbytes.static voidaddEntryToZip(String entryName, String content, String charsetName, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add a ZIP entry tozipOutputwith the givenentryNameand stringcontentincharsetNameencoding.static voidaddFileEntriesInFolderToZip(File baseFolder, String prefix, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput) Add ZIP entries tozipOutputby 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 tozipOutputwith the givenentryNameand stringcontentincharsetNameencoding.- 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 tozipOutputwith the givenentryNameandbytes.- 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 tozipOutputwith the givenentryNameandbytesstarting fromoffsetinlength.- 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 tozipOutputby 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
-