class ExplodingInputStream extends java.io.InputStream implements InputStreamStatistics
The algorithm is described in the ZIP File Format Specification.
Modifier and Type | Field and Description |
---|---|
private BitStream |
bits
The stream of bits read from the input stream
|
private CircularBuffer |
buffer
Output buffer holding the decompressed data
|
private int |
dictionarySize
The size of the sliding dictionary (4K or 8K)
|
private BinaryTree |
distanceTree
The binary tree containing the 64 encoded distances
|
private java.io.InputStream |
in
The underlying stream containing the compressed data
|
private BinaryTree |
lengthTree
The binary tree containing the 64 encoded lengths
|
private BinaryTree |
literalTree
The binary tree containing the 256 encoded literals (null when only two trees are used)
|
private int |
minimumMatchLength |
private int |
numberOfTrees
The number of Shannon-Fano trees (2 or 3)
|
private long |
treeSizes |
private long |
uncompressedCount |
Constructor and Description |
---|
ExplodingInputStream(int dictionarySize,
int numberOfTrees,
java.io.InputStream in)
Create a new stream decompressing the content of the specified stream
using the explode algorithm.
|
Modifier and Type | Method and Description |
---|---|
void |
close() |
private void |
fillBuffer()
Fill the sliding dictionary with more data.
|
long |
getCompressedCount() |
long |
getUncompressedCount() |
private void |
init()
Reads the encoded binary trees and prepares the bit stream.
|
int |
read() |
private final java.io.InputStream in
private BitStream bits
private final int dictionarySize
private final int numberOfTrees
private final int minimumMatchLength
private BinaryTree literalTree
private BinaryTree lengthTree
private BinaryTree distanceTree
private final CircularBuffer buffer
private long uncompressedCount
private long treeSizes
public ExplodingInputStream(int dictionarySize, int numberOfTrees, java.io.InputStream in)
dictionarySize
- the size of the sliding dictionary (4096 or 8192)numberOfTrees
- the number of trees (2 or 3)in
- the compressed data streamprivate void init() throws java.io.IOException
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public long getCompressedCount()
getCompressedCount
in interface InputStreamStatistics
public long getUncompressedCount()
getUncompressedCount
in interface InputStreamStatistics
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
private void fillBuffer() throws java.io.IOException
java.io.IOException