Class SnappyCompressorInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.compressors.CompressorInputStream
org.apache.commons.compress.compressors.lz77support.AbstractLZ77CompressorInputStream
org.apache.commons.compress.compressors.snappy.SnappyCompressorInputStream
- All Implemented Interfaces:
Closeable
,AutoCloseable
,InputStreamStatistics
CompressorInputStream for the raw Snappy format.
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.
- Since:
- 1.7
- See Also:
-
Field Summary
Fields inherited from class org.apache.commons.compress.compressors.lz77support.AbstractLZ77CompressorInputStream
supplier
-
Constructor Summary
ConstructorDescriptionConstructor using the default buffer size of 32k.SnappyCompressorInputStream
(InputStream is, int blockSize) Constructor using a configurable buffer size. -
Method Summary
Methods inherited from class org.apache.commons.compress.compressors.lz77support.AbstractLZ77CompressorInputStream
available, close, getCompressedCount, hasMoreDataInBlock, prefill, read, readBackReference, readLiteral, readOneByte, startBackReference, startLiteral
Methods inherited from class org.apache.commons.compress.compressors.CompressorInputStream
count, count, getBytesRead, getCount, getUncompressedCount, pushedBackBytes
Methods inherited from class java.io.InputStream
mark, markSupported, read, reset, skip
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.commons.compress.utils.InputStreamStatistics
getUncompressedCount
-
Field Details
-
DEFAULT_BLOCK_SIZE
Default block size- See Also:
-
-
Constructor Details
-
SnappyCompressorInputStream
Constructor using the default buffer size of 32k.- Parameters:
is
- An InputStream to read compressed data from- Throws:
IOException
- if reading fails
-
SnappyCompressorInputStream
Constructor using a configurable buffer size.- Parameters:
is
- An InputStream to read compressed data fromblockSize
- The block size used in compression- Throws:
IOException
- if reading failsIllegalArgumentException
- if blockSize is not bigger than 0
-
-
Method Details
-
getSize
Gets the uncompressed size of the stream- Overrides:
getSize
in classAbstractLZ77CompressorInputStream
- Returns:
- the uncompressed size
-
read
- Overrides:
read
in classInputStream
- Throws:
IOException
-