public class SnappyCompressorInputStream extends CompressorInputStream
This implementation uses an internal buffer in order to handle the back-references that are at the heart of the LZ77 algorithm. The size of the buffer must be at least as big as the biggest offset used in the compressed stream. The current version of the Snappy algorithm as defined by Google works on 32k blocks and doesn't contain offsets bigger than 32k which is the default block size used by this class.
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BLOCK_SIZE
Default block size
|
| Constructor and Description |
|---|
SnappyCompressorInputStream(InputStream is)
Constructor using the default buffer size of 32k.
|
SnappyCompressorInputStream(InputStream is,
int blockSize)
Constructor using a configurable buffer size.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
int |
getSize()
Get the uncompressed size of the stream
|
int |
read() |
int |
read(byte[] b,
int off,
int len) |
count, count, getBytesRead, getCount, pushedBackBytesmark, markSupported, read, reset, skippublic static final int DEFAULT_BLOCK_SIZE
public SnappyCompressorInputStream(InputStream is) throws IOException
is - An InputStream to read compressed data fromIOException - if reading failspublic SnappyCompressorInputStream(InputStream is, int blockSize) throws IOException
is - An InputStream to read compressed data fromblockSize - The block size used in compressionIOException - if reading failspublic int read() throws IOException
read in class InputStreamIOExceptionpublic void close() throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic int available()
available in class InputStreampublic int read(byte[] b, int off, int len) throws IOException
read in class InputStreamIOExceptionpublic int getSize()
Copyright © 2016 The Apache Software Foundation. All rights reserved.