org.apache.hadoop.io.compress
Class BZip2Codec

java.lang.Object
  extended by org.apache.hadoop.io.compress.BZip2Codec
All Implemented Interfaces:
CompressionCodec, SplittableCompressionCodec

public class BZip2Codec
extends Object
implements SplittableCompressionCodec

This class provides CompressionOutputStream and CompressionInputStream for compression and decompression. Currently we dont have an implementation of the Compressor and Decompressor interfaces, so those methods of CompressionCodec which have a Compressor or Decompressor type argument, throw UnsupportedOperationException.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.io.compress.SplittableCompressionCodec
SplittableCompressionCodec.READ_MODE
 
Constructor Summary
BZip2Codec()
          Creates a new instance of BZip2Codec
 
Method Summary
 Compressor createCompressor()
          This functionality is currently not supported.
 Decompressor createDecompressor()
          This functionality is currently not supported.
 CompressionInputStream createInputStream(InputStream in)
          Creates CompressionInputStream to be used to read off uncompressed data.
 CompressionInputStream createInputStream(InputStream in, Decompressor decompressor)
          This functionality is currently not supported.
 SplitCompressionInputStream createInputStream(InputStream seekableIn, Decompressor decompressor, long start, long end, SplittableCompressionCodec.READ_MODE readMode)
          Creates CompressionInputStream to be used to read off uncompressed data in one of the two reading modes.
 CompressionOutputStream createOutputStream(OutputStream out)
          Creates CompressionOutputStream for BZip2
 CompressionOutputStream createOutputStream(OutputStream out, Compressor compressor)
          Creates a compressor using given OutputStream.
 Class<? extends Compressor> getCompressorType()
          This functionality is currently not supported.
 Class<? extends Decompressor> getDecompressorType()
          This functionality is currently not supported.
 String getDefaultExtension()
          .bz2 is recognized as the default extension for compressed BZip2 files
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BZip2Codec

public BZip2Codec()
Creates a new instance of BZip2Codec

Method Detail

createOutputStream

public CompressionOutputStream createOutputStream(OutputStream out)
                                           throws IOException
Creates CompressionOutputStream for BZip2

Specified by:
createOutputStream in interface CompressionCodec
Parameters:
out - The output Stream
Returns:
The BZip2 CompressionOutputStream
Throws:
IOException - Throws IO exception

createOutputStream

public CompressionOutputStream createOutputStream(OutputStream out,
                                                  Compressor compressor)
                                           throws IOException
Creates a compressor using given OutputStream.

Specified by:
createOutputStream in interface CompressionCodec
Parameters:
out - the location for the final output stream
compressor - compressor to use
Returns:
CompressionOutputStream
Throws:
IOException

getCompressorType

public Class<? extends Compressor> getCompressorType()
This functionality is currently not supported.

Specified by:
getCompressorType in interface CompressionCodec
Returns:
BZip2DummyCompressor.class

createCompressor

public Compressor createCompressor()
This functionality is currently not supported.

Specified by:
createCompressor in interface CompressionCodec
Returns:
Compressor

createInputStream

public CompressionInputStream createInputStream(InputStream in)
                                         throws IOException
Creates CompressionInputStream to be used to read off uncompressed data.

Specified by:
createInputStream in interface CompressionCodec
Parameters:
in - The InputStream
Returns:
Returns CompressionInputStream for BZip2
Throws:
IOException - Throws IOException

createInputStream

public CompressionInputStream createInputStream(InputStream in,
                                                Decompressor decompressor)
                                         throws IOException
This functionality is currently not supported.

Specified by:
createInputStream in interface CompressionCodec
Parameters:
in - the stream to read compressed bytes from
decompressor - decompressor to use
Returns:
CompressionInputStream
Throws:
IOException

createInputStream

public SplitCompressionInputStream createInputStream(InputStream seekableIn,
                                                     Decompressor decompressor,
                                                     long start,
                                                     long end,
                                                     SplittableCompressionCodec.READ_MODE readMode)
                                              throws IOException
Creates CompressionInputStream to be used to read off uncompressed data in one of the two reading modes. i.e. Continuous or Blocked reading modes

Specified by:
createInputStream in interface SplittableCompressionCodec
Parameters:
seekableIn - The InputStream
start - The start offset into the compressed stream
end - The end offset into the compressed stream
readMode - Controls whether progress is reported continuously or only at block boundaries.
Returns:
CompressionInputStream for BZip2 aligned at block boundaries
Throws:
IOException

getDecompressorType

public Class<? extends Decompressor> getDecompressorType()
This functionality is currently not supported.

Specified by:
getDecompressorType in interface CompressionCodec
Returns:
BZip2DummyDecompressor.class

createDecompressor

public Decompressor createDecompressor()
This functionality is currently not supported.

Specified by:
createDecompressor in interface CompressionCodec
Returns:
Decompressor

getDefaultExtension

public String getDefaultExtension()
.bz2 is recognized as the default extension for compressed BZip2 files

Specified by:
getDefaultExtension in interface CompressionCodec
Returns:
A String telling the default bzip2 file extension


Copyright © 2009 The Apache Software Foundation