Class CompressionUtil

java.lang.Object
org.apache.commons.jcs3.utils.zip.CompressionUtil

public final class CompressionUtil extends Object
Compress / Decompress.
  • Method Details

    • decompressByteArray

      public static byte[] decompressByteArray(byte[] input)
      Decompress the byte array passed using a default buffer length of 1024.

      Parameters:
      input - compressed byte array webservice response
      Returns:
      uncompressed byte array
    • decompressByteArray

      public static byte[] decompressByteArray(byte[] input, int bufferLength)
      Decompress the byte array passed

      Parameters:
      input - compressed byte array webservice response
      bufferLength - buffer length
      Returns:
      uncompressed byte array
    • compressByteArray

      public static byte[] compressByteArray(byte[] input) throws IOException
      Compress the byte array passed

      Parameters:
      input - byte array
      Returns:
      compressed byte array
      Throws:
      IOException - thrown if we can't close the output stream
    • compressByteArray

      public static byte[] compressByteArray(byte[] input, int bufferLength) throws IOException
      Compress the byte array passed

      Parameters:
      input - byte array
      bufferLength - buffer length
      Returns:
      compressed byte array
      Throws:
      IOException - thrown if we can't close the output stream
    • decompressGzipByteArray

      public static byte[] decompressGzipByteArray(byte[] compressedByteArray) throws IOException
      decompress a gzip byte array, using a default buffer length of 1024

      Parameters:
      compressedByteArray - gzip-compressed byte array
      Returns:
      decompressed byte array
      Throws:
      IOException - thrown if there was a failure to construct the GzipInputStream
    • decompressGzipByteArray

      public static byte[] decompressGzipByteArray(byte[] compressedByteArray, int bufferlength) throws IOException
      decompress a gzip byte array, using a default buffer length of 1024

      Parameters:
      compressedByteArray - gzip-compressed byte array
      bufferlength - size of the buffer in bytes
      Returns:
      decompressed byte array
      Throws:
      IOException - thrown if there was a failure to construct the GzipInputStream