Class SnappyFramedInputStream

java.lang.Object
java.io.InputStream
org.xerial.snappy.SnappyFramedInputStream
All Implemented Interfaces:
Closeable, AutoCloseable, Channel, ReadableByteChannel

public final class SnappyFramedInputStream extends InputStream implements ReadableByteChannel
Since:
1.1.0
  • Field Details

    • crc32

      private final Checksum crc32
    • rbc

      private final ReadableByteChannel rbc
    • frameHeader

      private final ByteBuffer frameHeader
    • verifyChecksums

      private final boolean verifyChecksums
    • bufferPool

      private final BufferPool bufferPool
    • input

      private ByteBuffer input
      A single frame read from the underlying InputStream.
    • uncompressedDirect

      private ByteBuffer uncompressedDirect
      The decompressed data from input.
    • closed

      private boolean closed
      Indicates if this instance has been closed.
    • eof

      private boolean eof
      Indicates if we have reached the EOF on input.
    • valid

      private int valid
      The position in input buffer to read to.
    • position

      private int position
      The next position to read from buffer.
    • buffer

      private byte[] buffer
      Buffer contains a copy of the uncompressed data for the block.
  • Constructor Details

    • SnappyFramedInputStream

      public SnappyFramedInputStream(InputStream in) throws IOException
      Creates a Snappy input stream to read data from the specified underlying input stream.

      Uses DefaultPoolFactory to obtain BufferPool for buffers.

      Parameters:
      in - the underlying input stream. Must not be null.
      Throws:
      IOException
    • SnappyFramedInputStream

      public SnappyFramedInputStream(InputStream in, BufferPool bufferPool) throws IOException
      Creates a Snappy input stream to read data from the specified underlying input stream.
      Parameters:
      in - the underlying input stream. Must not be null.
      bufferPool - Used to obtain buffer instances. Must not be null.
      Throws:
      IOException
    • SnappyFramedInputStream

      public SnappyFramedInputStream(InputStream in, boolean verifyChecksums) throws IOException
      Creates a Snappy input stream to read data from the specified underlying input stream.

      Uses DefaultPoolFactory to obtain BufferPool for buffers.

      Parameters:
      in - the underlying input stream. Must not be null.
      verifyChecksums - if true, checksums in input stream will be verified
      Throws:
      IOException
    • SnappyFramedInputStream

      public SnappyFramedInputStream(InputStream in, boolean verifyChecksums, BufferPool bufferPool) throws IOException
      Creates a Snappy input stream to read data from the specified underlying input stream.
      Parameters:
      in - the underlying input stream. Must not be null.
      verifyChecksums - if true, checksums in input stream will be verified
      bufferPool - Used to obtain buffer instances. Must not be null.
      Throws:
      IOException
    • SnappyFramedInputStream

      public SnappyFramedInputStream(ReadableByteChannel in, BufferPool bufferPool) throws IOException
      Creates a Snappy input stream to read data from the specified underlying channel.
      Parameters:
      in - the underlying readable channel. Must not be null.
      bufferPool - Used to obtain buffer instances. Must not be null.
      Throws:
      IOException
    • SnappyFramedInputStream

      public SnappyFramedInputStream(ReadableByteChannel in) throws IOException
      Creates a Snappy input stream to read data from the specified underlying channel.

      Uses DefaultPoolFactory to obtain BufferPool for buffers.

      Parameters:
      in - the underlying readable channel. Must not be null.
      Throws:
      IOException
    • SnappyFramedInputStream

      public SnappyFramedInputStream(ReadableByteChannel in, boolean verifyChecksums) throws IOException
      Creates a Snappy input stream to read data from the specified underlying channel.

      Uses DefaultPoolFactory to obtain BufferPool for buffers.

      Parameters:
      in - the underlying readable channel. Must not be null.
      verifyChecksums - if true, checksums in input stream will be verified
      Throws:
      IOException
    • SnappyFramedInputStream

      public SnappyFramedInputStream(ReadableByteChannel in, boolean verifyChecksums, BufferPool bufferPool) throws IOException
      Creates a Snappy input stream to read data from the specified underlying channel.
      Parameters:
      in - the underlying readable channel. Must not be null.
      verifyChecksums - if true, checksums in input stream will be verified
      bufferPool - Used to obtain buffer instances. Must not be null.
      Throws:
      IOException
  • Method Details