org.apache.hadoop.io.compress
Interface CompressionCodec

All Known Implementing Classes:
BZip2Codec, DefaultCodec, GzipCodec, SnappyCodec

public interface CompressionCodec

This class encapsulates a streaming compression/decompression pair.


Method Summary
 Compressor createCompressor()
          Create a new Compressor for use by this CompressionCodec.
 Decompressor createDecompressor()
          Create a new Decompressor for use by this CompressionCodec.
 CompressionInputStream createInputStream(InputStream in)
          Create a stream decompressor that will read from the given input stream.
 CompressionInputStream createInputStream(InputStream in, Decompressor decompressor)
          Create a CompressionInputStream that will read from the given InputStream with the given Decompressor.
 CompressionOutputStream createOutputStream(OutputStream out)
          Create a CompressionOutputStream that will write to the given OutputStream.
 CompressionOutputStream createOutputStream(OutputStream out, Compressor compressor)
          Create a CompressionOutputStream that will write to the given OutputStream with the given Compressor.
 Class<? extends Compressor> getCompressorType()
          Get the type of Compressor needed by this CompressionCodec.
 Class<? extends Decompressor> getDecompressorType()
          Get the type of Decompressor needed by this CompressionCodec.
 String getDefaultExtension()
          Get the default filename extension for this kind of compression.
 

Method Detail

createOutputStream

CompressionOutputStream createOutputStream(OutputStream out)
                                           throws IOException
Create a CompressionOutputStream that will write to the given OutputStream.

Parameters:
out - the location for the final output stream
Returns:
a stream the user can write uncompressed data to have it compressed
Throws:
IOException

createOutputStream

CompressionOutputStream createOutputStream(OutputStream out,
                                           Compressor compressor)
                                           throws IOException
Create a CompressionOutputStream that will write to the given OutputStream with the given Compressor.

Parameters:
out - the location for the final output stream
compressor - compressor to use
Returns:
a stream the user can write uncompressed data to have it compressed
Throws:
IOException

getCompressorType

Class<? extends Compressor> getCompressorType()
Get the type of Compressor needed by this CompressionCodec.

Returns:
the type of compressor needed by this codec.

createCompressor

Compressor createCompressor()
Create a new Compressor for use by this CompressionCodec.

Returns:
a new compressor for use by this codec

createInputStream

CompressionInputStream createInputStream(InputStream in)
                                         throws IOException
Create a stream decompressor that will read from the given input stream.

Parameters:
in - the stream to read compressed bytes from
Returns:
a stream to read uncompressed bytes from
Throws:
IOException

createInputStream

CompressionInputStream createInputStream(InputStream in,
                                         Decompressor decompressor)
                                         throws IOException
Create a CompressionInputStream that will read from the given InputStream with the given Decompressor.

Parameters:
in - the stream to read compressed bytes from
decompressor - decompressor to use
Returns:
a stream to read uncompressed bytes from
Throws:
IOException

getDecompressorType

Class<? extends Decompressor> getDecompressorType()
Get the type of Decompressor needed by this CompressionCodec.

Returns:
the type of decompressor needed by this codec.

createDecompressor

Decompressor createDecompressor()
Create a new Decompressor for use by this CompressionCodec.

Returns:
a new decompressor for use by this codec

getDefaultExtension

String getDefaultExtension()
Get the default filename extension for this kind of compression.

Returns:
the extension including the '.'


Copyright © 2009 The Apache Software Foundation