Package org.apache.nutch.util
Class DeflateUtils
java.lang.Object
org.apache.nutch.util.DeflateUtils
A collection of utility methods for working on deflated data.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic final byte[]deflate(byte[] in) Returns a deflated copy of the input array.static final byte[]inflate(byte[] in) Returns an inflated copy of the input array.static final byte[]inflateBestEffort(byte[] in) Returns an inflated copy of the input array.static final byte[]inflateBestEffort(byte[] in, int sizeLimit) Returns an inflated copy of the input array, truncated tosizeLimitbytes, if necessary.
-
Constructor Details
-
DeflateUtils
public DeflateUtils()
-
-
Method Details
-
inflateBestEffort
public static final byte[] inflateBestEffort(byte[] in) Returns an inflated copy of the input array. If the deflated input has been truncated or corrupted, a best-effort attempt is made to inflate as much as possible. If no data can be extractednullis returned.- Parameters:
in- Deflated byte array- Returns:
- An inflated copy of the input array, otherwise null
-
inflateBestEffort
public static final byte[] inflateBestEffort(byte[] in, int sizeLimit) Returns an inflated copy of the input array, truncated tosizeLimitbytes, if necessary. If the deflated input has been truncated or corrupted, a best-effort attempt is made to inflate as much as possible. If no data can be extractednullis returned.- Parameters:
in- Deflated byte arraysizeLimit- Maximum size (bytes) allowed for inflated copy- Returns:
- An inflated copy of the input array, otherwise null
-
inflate
Returns an inflated copy of the input array.- Parameters:
in- Deflated byte array- Returns:
- An inflated copy of the input array, otherwise null
- Throws:
IOException- if the input cannot be properly decompressed
-
deflate
public static final byte[] deflate(byte[] in) Returns a deflated copy of the input array.- Parameters:
in- Inflated byte array- Returns:
- A deflated copy of the input array, otherwise null
-