Class CompressorInputStream
java.lang.Object
java.io.InputStream
org.apache.commons.compress.compressors.CompressorInputStream
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
AbstractLZ77CompressorInputStream,BZip2CompressorInputStream,Deflate64CompressorInputStream,DeflateCompressorInputStream,FramedLZ4CompressorInputStream,FramedSnappyCompressorInputStream,GzipCompressorInputStream,LZMACompressorInputStream,LZWInputStream,XZCompressorInputStream
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcount(int read) Increments the counter of already read bytes.protected voidcount(long read) Increments the counter of already read bytes.longReturns the current number of bytes read from this stream.intgetCount()Deprecated.this method may yield wrong results for large archives, use #getBytesRead insteadlongReturns the amount of raw or compressed bytes read by the stream.protected voidpushedBackBytes(long pushedBack) Decrements the counter of already read bytes.Methods inherited from class java.io.InputStream
available, close, mark, markSupported, nullInputStream, read, read, read, readAllBytes, readNBytes, readNBytes, reset, skip, skipNBytes, transferTo
-
Field Details
-
bytesRead
private long bytesRead
-
-
Constructor Details
-
CompressorInputStream
public CompressorInputStream()
-
-
Method Details
-
count
protected void count(int read) Increments the counter of already read bytes. Doesn't increment if the EOF has been hit (read == -1)- Parameters:
read- the number of bytes read- Since:
- 1.1
-
count
protected void count(long read) Increments the counter of already read bytes. Doesn't increment if the EOF has been hit (read == -1)- Parameters:
read- the number of bytes read
-
pushedBackBytes
protected void pushedBackBytes(long pushedBack) Decrements the counter of already read bytes.- Parameters:
pushedBack- the number of bytes pushed back.- Since:
- 1.7
-
getCount
Deprecated.this method may yield wrong results for large archives, use #getBytesRead insteadReturns the current number of bytes read from this stream.- Returns:
- the number of read bytes
-
getBytesRead
public long getBytesRead()Returns the current number of bytes read from this stream.- Returns:
- the number of read bytes
- Since:
- 1.1
-
getUncompressedCount
public long getUncompressedCount()Returns the amount of raw or compressed bytes read by the stream.This implementation invokes
getBytesRead().Provides half of
InputStreamStatisticswithout forcing subclasses to implement the other half.- Returns:
- the amount of decompressed bytes returned by the stream
- Since:
- 1.17
-