## org.apache.hadoop.io.compress
Class BZip2Codec

    java.lang.Object
      org.apache.hadoop.io.compress.BZip2Codec

All Implemented Interfaces:
  CompressionCodec

    public class BZip2Codec

extends Object
implements CompressionCodec

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.

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.
`CompressionOutputStream` `createOutputStream(OutputStream out)` Creates CompressionOutputStream for BZip2
`CompressionOutputStream` `createOutputStream(OutputStream out, Compressor compressor)` This functionality is currently not supported.
`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

  This functionality is currently not supported.

  Specified by:
    `createOutputStream` in interface `CompressionCodec`
  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:
    `UnsupportedOperationException` - Throws UnsupportedOperationException
    `IOException`

### getCompressorType

    public Class<? extends Compressor> getCompressorType()

  This functionality is currently not supported.

  Specified by:
    `getCompressorType` in interface `CompressionCodec`
  Returns:
    the type of compressor needed by this codec.
  Throws:
    `UnsupportedOperationException` - Throws UnsupportedOperationException

### createCompressor

    public Compressor createCompressor()

  This functionality is currently not supported.

  Specified by:
    `createCompressor` in interface `CompressionCodec`
  Returns:
    a new compressor for use by this codec
  Throws:
    `UnsupportedOperationException` - Throws UnsupportedOperationException

### 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:
    a stream to read uncompressed bytes from
  Throws:
    `UnsupportedOperationException` - Throws UnsupportedOperationException
    `IOException`

### getDecompressorType

    public Class<? extends Decompressor> getDecompressorType()

  This functionality is currently not supported.

  Specified by:
    `getDecompressorType` in interface `CompressionCodec`
  Returns:
    the type of decompressor needed by this codec.
  Throws:
    `UnsupportedOperationException` - Throws UnsupportedOperationException

### createDecompressor

    public Decompressor createDecompressor()

  This functionality is currently not supported.

  Specified by:
    `createDecompressor` in interface `CompressionCodec`
  Returns:
    a new decompressor for use by this codec
  Throws:
    `UnsupportedOperationException` - Throws UnsupportedOperationException

### 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