SMILA (incubation) API documentation

org.eclipse.smila.connectivity.framework.crawler.web.util
Class GZIPUtils

java.lang.Object
  extended by org.eclipse.smila.connectivity.framework.crawler.web.util.GZIPUtils

public final class GZIPUtils
extends java.lang.Object

A collection of utility methods for working on GZIPed data.


Method Summary
static byte[] unzip(byte[] in)
          Returns an gunzipped copy of the input array.
static byte[] unzipBestEffort(byte[] in)
          Returns an gunzipped copy of the input array.
static byte[] unzipBestEffort(byte[] in, int sizeLimit)
          Returns an gunzipped copy of the input array, truncated to sizeLimit bytes, if necessary.
static byte[] zip(byte[] in)
          Returns an gzipped copy of the input array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

unzipBestEffort

public static byte[] unzipBestEffort(byte[] in)
Returns an gunzipped copy of the input array. If the gzipped input has been truncated or corrupted, a best-effort attempt is made to unzip as much as possible. If no data can be extracted null is returned.

Parameters:
in - input byte array
Returns:
byte array

unzipBestEffort

public static byte[] unzipBestEffort(byte[] in,
                                     int sizeLimit)
Returns an gunzipped copy of the input array, truncated to sizeLimit bytes, if necessary. If the gzipped input has been truncated or corrupted, a best-effort attempt is made to unzip as much as possible. If no data can be extracted null is returned.

Parameters:
in - input byte array
sizeLimit - value in bytes to truncate gunzziped copy of the input array
Returns:
gunzipped byte array

unzip

public static byte[] unzip(byte[] in)
                    throws java.io.IOException
Returns an gunzipped copy of the input array.

Parameters:
in - input byte array
Returns:
gunzipped copy of the input array
Throws:
java.io.IOException - if the input cannot be properly decompressed

zip

public static byte[] zip(byte[] in)
Returns an gzipped copy of the input array.

Parameters:
in - input byte array
Returns:
byte gzipped copy of the input array

SMILA (incubation) API documentation