SnappyDecompressor (Hadoop 0.20.2-cdh3u5 API)
Date: 2012-10-05

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.snappy
Class SnappyDecompressor

    java.lang.Object
      org.apache.hadoop.io.compress.snappy.SnappyDecompressor

All Implemented Interfaces:
  Decompressor

    public class SnappyDecompressor

extends Object
implements Decompressor

A `Decompressor` based on the snappy compression algorithm. http://code.google.com/p/snappy/

Constructor Summary
`SnappyDecompressor()` Creates a new decompressor with the default buffer size.
`SnappyDecompressor(int directBufferSize)` Creates a new compressor.

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 decompressed data output stream has been reached.
`boolean` | `needsDictionary()` Returns `false`.
`boolean` | `needsInput()` Returns true if the input data buffer is empty and `setInput(byte[], int, int)` should be called to provide more input.
`void` | `reset()` Resets decompressor and input and output buffers so that a new set of input data can be processed.
`void` | `setDictionary(byte[] b, int off, int len)` Does nothing.
`void` | `setInput(byte[] b, int off, int len)` Sets input data for decompression.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SnappyDecompressor

    public SnappyDecompressor(int directBufferSize)

  Creates a new compressor.

  Parameters:
    `directBufferSize` - size of the direct buffer to be used.

### SnappyDecompressor

    public SnappyDecompressor()

  Creates a new decompressor with the default buffer size.

Method Detail

### setInput

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

  Sets input data for decompression. This should be called if and only if `needsInput()` returns `true` indicating that more input data is required. (Both native and non-native versions of various Decompressors require that the data passed in via `b[]` remain unmodified until the caller is explicitly notified--via `needsInput()`--that the buffer may be safely modified. With this requirement, an extra buffer-copy can be avoided.)

  Specified by:
    `setInput` in interface `Decompressor`
  Parameters:
    `b` - Input data
    `off` - Start offset
    `len` - Length

### setDictionary

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

  Does nothing.

  Specified by:
    `setDictionary` in interface `Decompressor`
  Parameters:
    `b` - Dictionary data bytes
    `off` - Start offset
    `len` - Length

### needsInput

    public boolean needsInput()

  Returns true if the input data buffer is empty and `setInput(byte[], int, int)` should be called to provide more input.

  Specified by:
    `needsInput` in interface `Decompressor`
  Returns:
    `true` if the input data buffer is empty and `setInput(byte[], int, int)` should be called in order to provide more input.

### needsDictionary

    public boolean needsDictionary()

  Returns `false`.

  Specified by:
    `needsDictionary` in interface `Decompressor`
  Returns:
    `false`.

### finished

    public boolean finished()

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

  Specified by:
    `finished` in interface `Decompressor`
  Returns:
    `true` if the end of the decompressed data output stream has been reached.

### decompress

    public 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.

  Specified by:
    `decompress` in interface `Decompressor`
  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

    public void reset()

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

  Specified by:
    `reset` in interface `Decompressor`

### end

    public void end()

  Closes the decompressor and discards any unprocessed input.

  Specified by:
    `end` in interface `Decompressor`

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