org.apache.jcs.utils.zip
Class CompressionUtil

java.lang.Object
  extended by org.apache.jcs.utils.zip.CompressionUtil

public final class CompressionUtil
extends Object

Compress / Decompress.


Method Summary
static byte[] compressByteArray(byte[] input)
          Compress the byte array passed
static byte[] compressByteArray(byte[] input, int bufferLength)
          Compress the byte array passed
static byte[] decompressByteArray(byte[] input)
          Decompress the byte array passed using a default buffer length of 1024.
static byte[] decompressByteArray(byte[] input, int bufferLength)
          Decompress the byte array passed
static byte[] decompressGzipByteArray(byte[] compressedByteArray)
          decompress a gzip byte array, using a default buffer length of 1024
static byte[] decompressGzipByteArray(byte[] compressedByteArray, int bufferlength)
          decompress a gzip byte array, using a default buffer length of 1024
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

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


Copyright © 2002-2012 Apache Software Foundation. All Rights Reserved.