Package org.apache.hadoop.io.compress
Class DefaultCodec
java.lang.Object
org.apache.hadoop.io.compress.DefaultCodec
- All Implemented Interfaces:
Configurable,CompressionCodec,DirectDecompressionCodec
- Direct Known Subclasses:
GzipCodec
@Public
@Evolving
public class DefaultCodec
extends Object
implements Configurable, CompressionCodec, DirectDecompressionCodec
-
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.getConf()Return the configuration used by this object.Class<? extends Decompressor>Get the type ofDecompressorneeded by thisCompressionCodec.Get the default filename extension for this kind of compression.voidsetConf(Configuration conf) Set the configuration to be used by this object.
-
Constructor Details
-
DefaultCodec
public DefaultCodec()
-
-
Method Details
-
setConf
Description copied from interface:ConfigurableSet the configuration to be used by this object.- Specified by:
setConfin interfaceConfigurable- Parameters:
conf- configuration to be used
-
getConf
Description copied from interface:ConfigurableReturn the configuration used by this object.- Specified by:
getConfin interfaceConfigurable- Returns:
- Configuration
-
createOutputStream
Description copied from interface:CompressionCodecCreate aCompressionOutputStreamthat will write to the givenOutputStream.- Specified by:
createOutputStreamin interfaceCompressionCodec- 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- 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.
-
getCompressorType
Description copied from interface:CompressionCodecGet the type ofCompressorneeded by thisCompressionCodec.- Specified by:
getCompressorTypein interfaceCompressionCodec- Returns:
- the type of compressor needed by this codec.
-
createCompressor
Description copied from interface:CompressionCodecCreate a newCompressorfor use by thisCompressionCodec.- Specified by:
createCompressorin interfaceCompressionCodec- Returns:
- a new compressor for use by this codec
-
createInputStream
Description copied from interface:CompressionCodecCreate aCompressionInputStreamthat will read from the given input stream.- Specified by:
createInputStreamin interfaceCompressionCodec- 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- 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.
-
getDecompressorType
Description copied from interface:CompressionCodecGet the type ofDecompressorneeded by thisCompressionCodec.- Specified by:
getDecompressorTypein interfaceCompressionCodec- Returns:
- the type of decompressor needed by this codec.
-
createDecompressor
Description copied from interface:CompressionCodecCreate a newDecompressorfor use by thisCompressionCodec.- Specified by:
createDecompressorin interfaceCompressionCodec- Returns:
- a new decompressor for use by this codec
-
createDirectDecompressor
Create a newDirectDecompressorfor use by thisDirectDecompressionCodec.- Specified by:
createDirectDecompressorin interfaceDirectDecompressionCodec- 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- Returns:
- the extension including the '.'
-