Package org.apache.hadoop.io.compress
Class GzipCodec
java.lang.Object
org.apache.hadoop.io.compress.DefaultCodec
org.apache.hadoop.io.compress.GzipCodec
- All Implemented Interfaces:
Configurable,CompressionCodec,DirectDecompressionCodec
This class creates gzip compressors/decompressors.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.io.compress.CompressionCodec
org.apache.hadoop.io.compress.CompressionCodec.Util -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a newCompressorfor use by thisCompressionCodec.Create a newDecompressorfor use by thisCompressionCodec.Create a newDirectDecompressorfor use by thisDirectDecompressionCodec.Create aCompressionInputStreamthat will read from the given input stream.createInputStream(InputStream in, Decompressor decompressor) Create aCompressionInputStreamthat will read from the givenInputStreamwith the givenDecompressor.Create aCompressionOutputStreamthat will write to the givenOutputStream.createOutputStream(OutputStream out, Compressor compressor) Create aCompressionOutputStreamthat will write to the givenOutputStreamwith the givenCompressor.Class<? extends Compressor>Get the type ofCompressorneeded by thisCompressionCodec.Class<? extends Decompressor>Get the type ofDecompressorneeded by thisCompressionCodec.Get the default filename extension for this kind of compression.Methods inherited from class org.apache.hadoop.io.compress.DefaultCodec
getConf, setConf
-
Constructor Details
-
GzipCodec
public GzipCodec()
-
-
Method Details
-
createOutputStream
Description copied from interface:CompressionCodecCreate aCompressionOutputStreamthat will write to the givenOutputStream.- Specified by:
createOutputStreamin interfaceCompressionCodec- Overrides:
createOutputStreamin classDefaultCodec- Parameters:
out- the location for the final output stream- Returns:
- a stream the user can write uncompressed data to have it compressed
- Throws:
IOException- raised on errors performing I/O.
-
createOutputStream
public CompressionOutputStream createOutputStream(OutputStream out, Compressor compressor) throws IOException Description copied from interface:CompressionCodecCreate aCompressionOutputStreamthat will write to the givenOutputStreamwith the givenCompressor.- Specified by:
createOutputStreamin interfaceCompressionCodec- Overrides:
createOutputStreamin classDefaultCodec- Parameters:
out- the location for the final output streamcompressor- compressor to use- Returns:
- a stream the user can write uncompressed data to have it compressed
- Throws:
IOException- raised on errors performing I/O.
-
createCompressor
Description copied from interface:CompressionCodecCreate a newCompressorfor use by thisCompressionCodec.- Specified by:
createCompressorin interfaceCompressionCodec- Overrides:
createCompressorin classDefaultCodec- Returns:
- a new compressor for use by this codec
-
getCompressorType
Description copied from interface:CompressionCodecGet the type ofCompressorneeded by thisCompressionCodec.- Specified by:
getCompressorTypein interfaceCompressionCodec- Overrides:
getCompressorTypein classDefaultCodec- Returns:
- the type of compressor needed by this codec.
-
createInputStream
Description copied from interface:CompressionCodecCreate aCompressionInputStreamthat will read from the given input stream.- Specified by:
createInputStreamin interfaceCompressionCodec- Overrides:
createInputStreamin classDefaultCodec- Parameters:
in- the stream to read compressed bytes from- Returns:
- a stream to read uncompressed bytes from
- Throws:
IOException- raised on errors performing I/O.
-
createInputStream
public CompressionInputStream createInputStream(InputStream in, Decompressor decompressor) throws IOException Description copied from interface:CompressionCodecCreate aCompressionInputStreamthat will read from the givenInputStreamwith the givenDecompressor.- Specified by:
createInputStreamin interfaceCompressionCodec- Overrides:
createInputStreamin classDefaultCodec- Parameters:
in- the stream to read compressed bytes fromdecompressor- decompressor to use- Returns:
- a stream to read uncompressed bytes from
- Throws:
IOException- raised on errors performing I/O.
-
createDecompressor
Description copied from interface:CompressionCodecCreate a newDecompressorfor use by thisCompressionCodec.- Specified by:
createDecompressorin interfaceCompressionCodec- Overrides:
createDecompressorin classDefaultCodec- Returns:
- a new decompressor for use by this codec
-
getDecompressorType
Description copied from interface:CompressionCodecGet the type ofDecompressorneeded by thisCompressionCodec.- Specified by:
getDecompressorTypein interfaceCompressionCodec- Overrides:
getDecompressorTypein classDefaultCodec- Returns:
- the type of decompressor needed by this codec.
-
createDirectDecompressor
Description copied from class:DefaultCodecCreate a newDirectDecompressorfor use by thisDirectDecompressionCodec.- Specified by:
createDirectDecompressorin interfaceDirectDecompressionCodec- Overrides:
createDirectDecompressorin classDefaultCodec- Returns:
- a new direct decompressor for use by this codec
-
getDefaultExtension
Description copied from interface:CompressionCodecGet the default filename extension for this kind of compression.- Specified by:
getDefaultExtensionin interfaceCompressionCodec- Overrides:
getDefaultExtensionin classDefaultCodec- Returns:
- the extension including the '.'
-