Package org.apache.hadoop.io.compress
Class PassthroughCodec
java.lang.Object
org.apache.hadoop.io.compress.PassthroughCodec
- All Implemented Interfaces:
Configurable,CompressionCodec
@Public
@Unstable
public class PassthroughCodec
extends Object
implements Configurable, CompressionCodec
This is a special codec which does not transform the output.
It can be declared as a codec in the option "io.compression.codecs",
and then it will declare that it supports the file extension
set in
OPT_EXTENSION.
This allows decompression to be disabled on a job, even when there is
a registered/discoverable decompression codec for a file extension
-without having to change the standard codec binding mechanism.
For example, to disable decompression for a gzipped files, set the
options
io.compression.codecs = org.apache.hadoop.io.compress.PassthroughCodec io.compress.passthrough.extension = .gzNote: this is not a Splittable codec: it doesn't know the capabilities of the passed in stream. It should be possible to extend this in a subclass: the inner classes are marked as protected to enable this. Do not retrofit splitting to this class..
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static final classorg.apache.hadoop.io.compress.PassthroughCodec.PassthroughDecompressorStreamThe decompressor.protected static final classorg.apache.hadoop.io.compress.PassthroughCodec.StubDecompressorThe decompressor is a no-op.Nested classes/interfaces inherited from interface org.apache.hadoop.io.compress.CompressionCodec
org.apache.hadoop.io.compress.CompressionCodec.Util -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringClassname of the codec: "org.apache.hadoop.io.compress.PassthroughCodec".static final StringThis default extension is here so that if no extension has been defined, some value is still returned: ".passthrough"..static final StringOption to control the extension of the code: "io.compress.passthrough.extension". -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreate a newCompressorfor use by thisCompressionCodec.Create a newDecompressorfor use by thisCompressionCodec.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.
-
Field Details
-
CLASSNAME
Classname of the codec: "org.apache.hadoop.io.compress.PassthroughCodec".- See Also:
-
OPT_EXTENSION
Option to control the extension of the code: "io.compress.passthrough.extension".- See Also:
-
DEFAULT_EXTENSION
This default extension is here so that if no extension has been defined, some value is still returned: ".passthrough"..- See Also:
-
-
Constructor Details
-
PassthroughCodec
public PassthroughCodec()
-
-
Method Details
-
getConf
Description copied from interface:ConfigurableReturn the configuration used by this object.- Specified by:
getConfin interfaceConfigurable- Returns:
- Configuration
-
setConf
Description copied from interface:ConfigurableSet the configuration to be used by this object.- Specified by:
setConfin interfaceConfigurable- Parameters:
conf- configuration to be used
-
getDefaultExtension
Description copied from interface:CompressionCodecGet the default filename extension for this kind of compression.- Specified by:
getDefaultExtensionin interfaceCompressionCodec- Returns:
- the extension including the '.'
-
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
-