[TOC]

org.apache.nutch.util

Class GZIPUtils


public class GZIPUtils
extends Object

A collection of utility methods for working on GZIPed data.

Constructor Summary

Constructors Constructor and Description GZIPUtils()

Method Summary

Methods Modifier and Type Method and Description 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

Constructor Detail

-  

GZIPUtils

public GZIPUtils()

Method Detail

-  

unzipBestEffort

public static final 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.

-  

unzipBestEffort

public static final 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.

-  

unzip

public static final byte[] unzip(byte[] in)
                          throws IOException

Returns an gunzipped copy of the input array.

  - Throws: 
  - <code>IOException</code> - if the input cannot be properly decompressed       
-  

zip

public static final byte[] zip(byte[] in)

Returns an gzipped copy of the input array.

Copyright © 2014 The Apache Software Foundation