Decompressor (Hadoop 0.20.1+169.88 API)
Date: 2010-05-20

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.io.compress
Interface Decompressor

All Known Implementing Classes:
  BuiltInZlibInflater, BZip2DummyDecompressor, ZlibDecompressor

    public interface Decompressor

Specification of a stream-based 'de-compressor' which can be plugged into a `CompressionInputStream` to compress data. This is modelled after `Inflater`

Method Summary
`int` | `decompress(byte[] b, int off, int len)` Fills specified buffer with uncompressed data.
`void` | `end()` Closes the decompressor and discards any unprocessed input.
`boolean` | `finished()` Returns true if the end of the compressed data output stream has been reached.
`boolean` | `needsDictionary()` Returns `true` if a preset dictionary is needed for decompression.
`boolean` | `needsInput()` Returns true if the input data buffer is empty and #setInput() should be called to provide more input.
`void` | `reset()` Resets decompressor so that a new set of input data can be processed.
`void` | `setDictionary(byte[] b, int off, int len)` Sets preset dictionary for compression.
`void` | `setInput(byte[] b, int off, int len)` Sets input data for decompression.

Method Detail

### setInput

    void setInput(byte[] b,
                  int off,
                  int len)

  Sets input data for decompression. This should be called whenever #needsInput() returns `true` indicating that more input data is required.

  Parameters:
    `b` - Input data
    `off` - Start offset
    `len` - Length

### needsInput

    boolean needsInput()

  Returns true if the input data buffer is empty and #setInput() should be called to provide more input.

  Returns:
    `true` if the input data buffer is empty and #setInput() should be called in order to provide more input.

### setDictionary

    void setDictionary(byte[] b,
                       int off,
                       int len)

  Sets preset dictionary for compression. A preset dictionary is used when the history buffer can be predetermined.

  Parameters:
    `b` - Dictionary data bytes
    `off` - Start offset
    `len` - Length

### needsDictionary

    boolean needsDictionary()

  Returns `true` if a preset dictionary is needed for decompression.

  Returns:
    `true` if a preset dictionary is needed for decompression

### finished

    boolean finished()

  Returns true if the end of the compressed data output stream has been reached.

  Returns:
    `true` if the end of the compressed data output stream has been reached.

### decompress

    int decompress(byte[] b,
                   int off,
                   int len)
                   throws IOException

  Fills specified buffer with uncompressed data. Returns actual number of bytes of uncompressed data. A return value of 0 indicates that #needsInput() should be called in order to determine if more input data is required.

  Parameters:
    `b` - Buffer for the compressed data
    `off` - Start offset of the data
    `len` - Size of the buffer
  Returns:
    The actual number of bytes of compressed data.
  Throws:
    `IOException`

### reset

    void reset()

  Resets decompressor so that a new set of input data can be processed.

### end

    void end()

  Closes the decompressor and discards any unprocessed input.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation