java.lang.Object
org.onehippo.forge.content.exim.repository.jaxrs.util.ZipCompressUtils

public class ZipCompressUtils extends Object
ZIP Compressing Utilities.
  • Method Summary

    Modifier and Type
    Method
    Description
    static void
    addEntryToZip(String entryName, byte[] bytes, int offset, int length, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput)
    Add a ZIP entry to zipOutput with the given entryName and bytes starting from offset in length.
    static void
    addEntryToZip(String entryName, byte[] bytes, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput)
    Add a ZIP entry to zipOutput with the given entryName and bytes.
    static void
    addEntryToZip(String entryName, String content, String charsetName, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput)
    Add a ZIP entry to zipOutput with the given entryName and string content in charsetName encoding.
    static void
    addFileEntriesInFolderToZip(File baseFolder, String prefix, org.apache.commons.compress.archivers.zip.ZipArchiveOutputStream zipOutput)
    Add ZIP entries to zipOutput by selecting all the descendant files under the baseFolder, starting with the ZIP entry name prefix.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 to zipOutput with the given entryName and string content in charsetName encoding.
      Parameters:
      entryName - ZIP entry name
      content - string content of the ZIP entry.
      charsetName - charset name in encoding
      zipOutput - 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 to zipOutput with the given entryName and bytes.
      Parameters:
      entryName - ZIP entry name
      bytes - the byte array to fill in for the ZIP entry
      zipOutput - 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 to zipOutput with the given entryName and bytes starting from offset in length.
      Parameters:
      entryName - ZIP entry name
      bytes - the byte array to fill in for the ZIP entry
      offset - the starting offset index to read from the byte array
      length - the length to read from the byte array
      zipOutput - 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 to zipOutput by selecting all the descendant files under the baseFolder, starting with the ZIP entry name prefix.
      Parameters:
      baseFolder - base folder to find child files underneath
      prefix - the prefix of ZIP entry name
      zipOutput - ZipArchiveOutputStream instance
      Throws:
      IOException - if IO exception occurs