Class ZstdCompressorInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.commons.compress.compressors.CompressorInputStream
-
- org.apache.commons.compress.compressors.zstandard.ZstdCompressorInputStream
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,InputStreamStatistics
public class ZstdCompressorInputStream extends CompressorInputStream implements InputStreamStatistics
CompressorInputStreamimplementation to decode Zstandard encoded stream.This class avoids making the underlying
zstdclasses part of the public or protected API. The underlying implementation is provided through the Zstandard JNI library which is based on zstd.- Since:
- 1.16
- See Also:
- Zstandard JNI, zstd
-
-
Constructor Summary
Constructors Constructor Description ZstdCompressorInputStream(java.io.InputStream in)Constructs a new input stream that decompresses zstd-compressed data from the specific input stream.ZstdCompressorInputStream(java.io.InputStream in, com.github.luben.zstd.BufferPool bufferPool)Constructs a new input stream that decompresses zstd-compressed data from the specific input stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()longgetCompressedCount()Gets the amount of raw or compressed bytes read by the stream.voidmark(int readLimit)booleanmarkSupported()intread()intread(byte[] b)intread(byte[] buf, int off, int len)voidreset()longskip(long n)java.lang.StringtoString()-
Methods inherited from class org.apache.commons.compress.compressors.CompressorInputStream
count, count, getBytesRead, getCount, getUncompressedCount, pushedBackBytes
-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.compress.utils.InputStreamStatistics
getUncompressedCount
-
-
-
-
Constructor Detail
-
ZstdCompressorInputStream
public ZstdCompressorInputStream(java.io.InputStream in) throws java.io.IOException
Constructs a new input stream that decompresses zstd-compressed data from the specific input stream.- Parameters:
in- the input stream of compressed data.- Throws:
java.io.IOException- if an I/O error occurs.
-
ZstdCompressorInputStream
public ZstdCompressorInputStream(java.io.InputStream in, com.github.luben.zstd.BufferPool bufferPool) throws java.io.IOException
Constructs a new input stream that decompresses zstd-compressed data from the specific input stream.- Parameters:
in- the input stream of compressed data.bufferPool- a configuration of zstd-jni that allows users to customize how buffers are recycled. Either aNoPoolor aRecyclingBufferPoolis allowed here.- Throws:
java.io.IOException- if an I/O error occurs.
-
-
Method Detail
-
available
public int available() throws java.io.IOException
- Overrides:
availablein classjava.io.InputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException
- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.InputStream- Throws:
java.io.IOException
-
getCompressedCount
public long getCompressedCount()
Gets the amount of raw or compressed bytes read by the stream.- Specified by:
getCompressedCountin interfaceInputStreamStatistics- Returns:
- the amount of raw or compressed bytes read by the stream.
- Since:
- 1.17
-
mark
public void mark(int readLimit)
- Overrides:
markin classjava.io.InputStream
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classjava.io.InputStream
-
read
public int read() throws java.io.IOException
- Specified by:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] b) throws java.io.IOException
- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
read
public int read(byte[] buf, int off, int len) throws java.io.IOException
- Overrides:
readin classjava.io.InputStream- Throws:
java.io.IOException
-
reset
public void reset() throws java.io.IOException
- Overrides:
resetin classjava.io.InputStream- Throws:
java.io.IOException
-
skip
public long skip(long n) throws java.io.IOException
- Overrides:
skipin classjava.io.InputStream- Throws:
java.io.IOException
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-