org.jppf.utils
Class CompressionUtils

java.lang.Object
  extended by org.jppf.utils.CompressionUtils

public final class CompressionUtils
extends Object

Collection of utility methods for compressing and uncompressing data.

Author:
Laurent Cohen

Method Summary
static byte[] unzip(byte[] bytes, int start, int length)
          Uncompress an array of bytes using the gzip API.
static byte[] zip(byte[] bytes, int start, int length)
          Compress an array of bytes using the gzip API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

zip

public static byte[] zip(byte[] bytes,
                         int start,
                         int length)
                  throws Exception
Compress an array of bytes using the gzip API.

Parameters:
bytes - the array of bytes to compress.
start - the start position in the array of bytes.
length - the number of bytes to compress.
Returns:
the compressed bytes as an array of bytes.
Throws:
Exception - if an error occurs while compressing.

unzip

public static byte[] unzip(byte[] bytes,
                           int start,
                           int length)
                    throws Exception
Uncompress an array of bytes using the gzip API.

Parameters:
bytes - the array of bytes to uncompress.
start - the start position in the array of bytes.
length - the number of bytes to uncompress.
Returns:
the uncompressed bytes as an array.
Throws:
Exception - if an error occurs while uncompressing.


Copyright © 2005-2010 JPPF Team.