Top Description Fields Constructors Methods
org.apache.commons.compress.archivers.zip

pack-priv final Class ExplodingInputStream

extends InputStream
implements InputStreamStatistics
Class Inheritance
All Implemented Interfaces
org.apache.commons.compress.utils.InputStreamStatistics
Imports
java.io.IOException, .InputStream, org.apache.commons.compress.utils.ExactMath, .InputStreamStatistics, org.apache.commons.io.input.CloseShieldInputStream, .CountingInputStream

The implode compression method was added to PKZIP 1.01 released in 1989. It was then dropped from PKZIP 2.0 released in 1993 in favor of the deflate method.

The algorithm is described in the ZIP File Format Specification.

Since
1.7
See Also
ZIP File Format Specification

Field Summary

Modifier and TypeField and Description
private BitStream
bits

The stream of bits read from the input stream

private final CircularBuffer
buffer

Output buffer holding the decompressed data

private final int
dictionarySize

The size of the sliding dictionary (4K or 8K)

private BinaryTree
distanceTree

The binary tree containing the 64 encoded distances

private final 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 final int
private final int
numberOfTrees

The number of Shannon-Fano trees (2 or 3)

private long
private long

Constructor Summary

AccessConstructor and Description
pack-priv
ExplodingInputStream(final int
the size of the sliding dictionary (4096 or 8192)
dictionarySize
,
final int
the number of trees (2 or 3)
numberOfTrees
,
final InputStream
the compressed data stream
in
)

Constructs a new stream decompressing the content of the specified stream using the explode algorithm.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Closes this input stream and releases any system resources associated with the stream.
private void
fillBuffer()

Fill the sliding dictionary with more data.

public long
getCompressedCount()

Implements org.apache.commons.compress.utils.InputStreamStatistics.getCompressedCount.

Gets the amount of raw or compressed bytes read by the stream.
public long
getUncompressedCount()

Implements org.apache.commons.compress.utils.InputStreamStatistics.getUncompressedCount.

Gets the amount of decompressed bytes returned by the stream.
private void
init()

Reads the encoded binary trees and prepares the bit stream.

public int
read()

Implements abstract java.io.InputStream.read.

Reads the next byte of data from the input stream.
Inherited from java.io.InputStream:
availablemarkmarkSupportednullInputStreamreadreadreadAllBytesreadNBytesreadNBytesresetskipskipNBytestransferTo

Field Detail

bitsback to summary
private BitStream bits

The stream of bits read from the input stream

bufferback to summary
private final CircularBuffer buffer

Output buffer holding the decompressed data

dictionarySizeback to summary
private final int dictionarySize

The size of the sliding dictionary (4K or 8K)

distanceTreeback to summary
private BinaryTree distanceTree

The binary tree containing the 64 encoded distances

inback to summary
private final InputStream in

The underlying stream containing the compressed data

lengthTreeback to summary
private BinaryTree lengthTree

The binary tree containing the 64 encoded lengths

literalTreeback to summary
private BinaryTree literalTree

The binary tree containing the 256 encoded literals (null when only two trees are used)

minimumMatchLengthback to summary
private final int minimumMatchLength
numberOfTreesback to summary
private final int numberOfTrees

The number of Shannon-Fano trees (2 or 3)

treeSizesback to summary
private long treeSizes
uncompressedCountback to summary
private long uncompressedCount

Constructor Detail

ExplodingInputStreamback to summary
pack-priv ExplodingInputStream(final int dictionarySize, final int numberOfTrees, final InputStream in)

Constructs a new stream decompressing the content of the specified stream using the explode algorithm.

Parameters
dictionarySize:int

the size of the sliding dictionary (4096 or 8192)

numberOfTrees:int

the number of trees (2 or 3)

in:InputStream

the compressed data stream

Method Detail

closeback to summary
public void close() throws IOException

Overrides java.io.InputStream.close.

Implements java.io.Closeable.close.

Doc from java.io.InputStream.close.

Closes this input stream and releases any system resources associated with the stream.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.
Since
1.17
fillBufferback to summary
private void fillBuffer() throws IOException

Fill the sliding dictionary with more data.

Exceptions
IOException:
on error.
getCompressedCountback to summary
public long getCompressedCount()

Implements org.apache.commons.compress.utils.InputStreamStatistics.getCompressedCount.

Doc from org.apache.commons.compress.utils.InputStreamStatistics.getCompressedCount.

Gets the amount of raw or compressed bytes read by the stream.

Returns:long

the amount of raw or compressed bytes read by the stream.

Annotations
@Override
Since
1.17
getUncompressedCountback to summary
public long getUncompressedCount()

Implements org.apache.commons.compress.utils.InputStreamStatistics.getUncompressedCount.

Doc from org.apache.commons.compress.utils.InputStreamStatistics.getUncompressedCount.

Gets the amount of decompressed bytes returned by the stream.

Returns:long

the amount of decompressed bytes returned by the stream.

Annotations
@Override
Since
1.17
initback to summary
private void init() throws IOException

Reads the encoded binary trees and prepares the bit stream.

readback to summary
public int read() throws IOException

Implements abstract java.io.InputStream.read.

Doc from java.io.InputStream.read.

Reads the next byte of data from the input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the value -1 is returned. This method blocks until input data is available, the end of the stream is detected, or an exception is thrown.

Returns:int

the next byte of data, or -1 if the end of the stream is reached.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs.