Class BuiltInZlibDeflater
java.lang.Object
java.util.zip.Deflater
org.apache.hadoop.io.compress.zlib.BuiltInZlibDeflater
- All Implemented Interfaces:
Compressor
A wrapper around java.util.zip.Deflater to make it conform
to org.apache.hadoop.io.compress.Compressor interface.
-
Field Summary
Fields inherited from class java.util.zip.Deflater
BEST_COMPRESSION, BEST_SPEED, DEFAULT_COMPRESSION, DEFAULT_STRATEGY, DEFLATED, FILTERED, FULL_FLUSH, HUFFMAN_ONLY, NO_COMPRESSION, NO_FLUSH, SYNC_FLUSH -
Constructor Summary
ConstructorsConstructorDescriptionBuiltInZlibDeflater(int level) BuiltInZlibDeflater(int level, boolean nowrap) -
Method Summary
Modifier and TypeMethodDescriptionintcompress(byte[] b, int off, int len) Fills specified buffer with compressed data.voidreinit(Configuration conf) reinit the compressor with the given configuration.Methods inherited from class java.util.zip.Deflater
deflate, deflate, deflate, deflate, deflate, end, finish, finished, getAdler, getBytesRead, getBytesWritten, getTotalIn, getTotalOut, needsInput, reset, setDictionary, setDictionary, setDictionary, setInput, setInput, setInput, setLevel, setStrategyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.hadoop.io.compress.Compressor
end, finish, finished, getBytesRead, getBytesWritten, needsInput, reset, setDictionary, setInput
-
Constructor Details
-
BuiltInZlibDeflater
public BuiltInZlibDeflater(int level, boolean nowrap) -
BuiltInZlibDeflater
public BuiltInZlibDeflater(int level) -
BuiltInZlibDeflater
public BuiltInZlibDeflater()
-
-
Method Details
-
compress
Description copied from interface:CompressorFills specified buffer with compressed data. Returns actual number of bytes of compressed data. A return value of 0 indicates that needsInput() should be called in order to determine if more input data is required.- Specified by:
compressin interfaceCompressor- Parameters:
b- Buffer for the compressed dataoff- Start offset of the datalen- Size of the buffer- Returns:
- The actual number of bytes of compressed data.
- Throws:
IOException- raised on errors performing I/O.
-
reinit
reinit the compressor with the given configuration. It will reset the compressor's compression level and compression strategy. Different fromZlibCompressor,BuiltInZlibDeflateronly support three kind of compression strategy: FILTERED, HUFFMAN_ONLY and DEFAULT_STRATEGY. It will use DEFAULT_STRATEGY as default if the configured compression strategy is not supported.- Specified by:
reinitin interfaceCompressor- Parameters:
conf- Configuration from which new setting are fetched
-