Package org.apache.hadoop.io.compress
Class CodecPool
java.lang.Object
org.apache.hadoop.io.compress.CodecPool
A global compressor/decompressor pool used to save and reuse
(possibly native) compression/decompression codecs.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic CompressorgetCompressor(CompressionCodec codec) static CompressorgetCompressor(CompressionCodec codec, Configuration conf) Get aCompressorfor the givenCompressionCodecfrom the pool or a new one.static DecompressorgetDecompressor(CompressionCodec codec) Get aDecompressorfor the givenCompressionCodecfrom the pool or a new one.static intReturn the number of leasedCompressors for thisCompressionCodec.static intReturn the number of leasedDecompressors for thisCompressionCodec.static voidreturnCompressor(Compressor compressor) Return theCompressorto the pool.static voidreturnDecompressor(Decompressor decompressor) Return theDecompressorto the pool.
-
Constructor Details
-
CodecPool
public CodecPool()
-
-
Method Details
-
getCompressor
Get aCompressorfor the givenCompressionCodecfrom the pool or a new one.- Parameters:
codec- theCompressionCodecfor which to get theCompressorconf- theConfigurationobject which contains confs for creating or reinit the compressor- Returns:
Compressorfor the givenCompressionCodecfrom the pool or a new one
-
getCompressor
-
getDecompressor
Get aDecompressorfor the givenCompressionCodecfrom the pool or a new one.- Parameters:
codec- theCompressionCodecfor which to get theDecompressor- Returns:
Decompressorfor the givenCompressionCodecthe pool or a new one
-
returnCompressor
Return theCompressorto the pool.- Parameters:
compressor- theCompressorto be returned to the pool
-
returnDecompressor
Return theDecompressorto the pool.- Parameters:
decompressor- theDecompressorto be returned to the pool
-
getLeasedCompressorsCount
Return the number of leasedCompressors for thisCompressionCodec.- Parameters:
codec- codec.- Returns:
- the number of leased.
-
getLeasedDecompressorsCount
Return the number of leasedDecompressors for thisCompressionCodec.- Parameters:
codec- codec.- Returns:
- the number of leased
-