Class SnappyFramedInputStream
java.lang.Object
java.io.InputStream
org.xerial.snappy.SnappyFramedInputStream
- All Implemented Interfaces:
Closeable, AutoCloseable, Channel, ReadableByteChannel
- Since:
- 1.1.0
- Author:
- Brett Okken
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final class -
Constructor Summary
ConstructorsConstructorDescriptionCreates a Snappy input stream to read data from the specified underlying input stream.SnappyFramedInputStream(InputStream in, boolean verifyChecksums) Creates a Snappy input stream to read data from the specified underlying input stream.SnappyFramedInputStream(InputStream in, boolean verifyChecksums, BufferPool bufferPool) Creates a Snappy input stream to read data from the specified underlying input stream.SnappyFramedInputStream(InputStream in, BufferPool bufferPool) Creates a Snappy input stream to read data from the specified underlying input stream.Creates a Snappy input stream to read data from the specified underlying channel.SnappyFramedInputStream(ReadableByteChannel in, boolean verifyChecksums) Creates a Snappy input stream to read data from the specified underlying channel.SnappyFramedInputStream(ReadableByteChannel in, boolean verifyChecksums, BufferPool bufferPool) Creates a Snappy input stream to read data from the specified underlying channel.SnappyFramedInputStream(ReadableByteChannel in, BufferPool bufferPool) Creates a Snappy input stream to read data from the specified underlying channel. -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()booleanisOpen()intread()intread(byte[] output, int offset, int length) intread(ByteBuffer dst) longTransfers the entire content of thisInputStreamto os.longTransfers the entire content of thisReadableByteChannelto wbc.Methods inherited from class InputStream
mark, markSupported, nullInputStream, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes
-
Constructor Details
-
SnappyFramedInputStream
Creates a Snappy input stream to read data from the specified underlying input stream.Uses
DefaultPoolFactoryto obtainBufferPoolfor buffers.- Parameters:
in- the underlying input stream. Must not benull.- Throws:
IOException
-
SnappyFramedInputStream
Creates a Snappy input stream to read data from the specified underlying input stream.- Parameters:
in- the underlying input stream. Must not benull.bufferPool- Used to obtain buffer instances. Must not benull.- Throws:
IOException
-
SnappyFramedInputStream
Creates a Snappy input stream to read data from the specified underlying input stream.Uses
DefaultPoolFactoryto obtainBufferPoolfor buffers.- Parameters:
in- the underlying input stream. Must not benull.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 benull.verifyChecksums- if true, checksums in input stream will be verifiedbufferPool- Used to obtain buffer instances. Must not benull.- Throws:
IOException
-
SnappyFramedInputStream
Creates a Snappy input stream to read data from the specified underlying channel.- Parameters:
in- the underlying readable channel. Must not benull.bufferPool- Used to obtain buffer instances. Must not benull.- Throws:
IOException
-
SnappyFramedInputStream
Creates a Snappy input stream to read data from the specified underlying channel.Uses
DefaultPoolFactoryto obtainBufferPoolfor buffers.- Parameters:
in- the underlying readable channel. Must not benull.- Throws:
IOException
-
SnappyFramedInputStream
Creates a Snappy input stream to read data from the specified underlying channel.Uses
DefaultPoolFactoryto obtainBufferPoolfor buffers.- Parameters:
in- the underlying readable channel. Must not benull.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 benull.verifyChecksums- if true, checksums in input stream will be verifiedbufferPool- Used to obtain buffer instances. Must not benull.- Throws:
IOException
-
-
Method Details
-
read
- Specified by:
readin classInputStream- Throws:
IOException
-
read
- Overrides:
readin classInputStream- Throws:
IOException
-
available
- Overrides:
availablein classInputStream- Throws:
IOException
-
isOpen
-
read
- Specified by:
readin interfaceReadableByteChannel- Throws:
IOException
-
transferTo
Transfers the entire content of thisInputStreamto os. This potentially limits the amount of buffering required to decompress content.Unlike
read(byte[], int, int), this method does not need to be called multiple times. A single call will transfer all available content. Any calls after the source has been exhausted will result in a return value of0.- Overrides:
transferToin classInputStream- Parameters:
os- The destination to write decompressed content to.- Returns:
- The number of bytes transferred.
- Throws:
IOException- Since:
- 1.1.1
-
transferTo
Transfers the entire content of thisReadableByteChannelto wbc. This potentially limits the amount of buffering required to decompress content.Unlike
read(ByteBuffer), this method does not need to be called multiple times. A single call will transfer all available content. Any calls after the source has been exhausted will result in a return value of0.- Parameters:
wbc- The destination to write decompressed content to.- Returns:
- The number of bytes transferred.
- Throws:
IOException- Since:
- 1.1.1
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceChannel- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-