Class ZstdInputStreamNoFinalizer
java.lang.Object
java.io.InputStream
java.io.FilterInputStream
com.github.luben.zstd.ZstdInputStreamNoFinalizer
- All Implemented Interfaces:
Closeable, AutoCloseable
InputStream filter that decompresses the data provided
by the underlying InputStream using Zstd compression.
It does not support mark/reset methods. It also does not have finalizer,
so if you rely on finalizers to clean the native memory and release
buffers use `ZstdInputStream` instead.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final BufferPoolprivate longprivate booleanprivate booleanprivate booleanprivate booleanprivate final byte[]private static final intprivate final ByteBufferprivate longprivate longprivate final longFields inherited from class FilterInputStream
in -
Constructor Summary
ConstructorsConstructorDescriptionZstdInputStreamNoFinalizer(InputStream inStream) create a new decompressing InputStreamZstdInputStreamNoFinalizer(InputStream inStream, BufferPool bufferPool) create a new decompressing InputStream -
Method Summary
Modifier and TypeMethodDescriptionintvoidclose()private static longprivate intdecompressStream(long stream, byte[] dst, int dst_size, byte[] src, int src_size) private static intfreeDStream(long stream) booleanprivate intinitDStream(long stream) booleanintread()intread(byte[] dst, int offset, int len) (package private) intreadInternal(byte[] dst, int offset, int len) static longstatic longsetContinuous(boolean b) Don't break on unfinished frames Use case: decompressing files that are not yet finished writing and compressingsetDict(byte[] dict) setDict(ZstdDictDecompress dict) setLongMax(int windowLogMax) longskip(long numBytes) Methods inherited from class FilterInputStream
mark, read, resetMethods inherited from class InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, skipNBytes, transferTo
-
Field Details
-
stream
private final long stream -
dstPos
private long dstPos -
srcPos
private long srcPos -
srcSize
private long srcSize -
needRead
private boolean needRead -
bufferPool
-
srcByteBuffer
-
src
private final byte[] src -
srcBuffSize
private static final int srcBuffSize -
isContinuous
private boolean isContinuous -
frameFinished
private boolean frameFinished -
isClosed
private boolean isClosed
-
-
Constructor Details
-
ZstdInputStreamNoFinalizer
create a new decompressing InputStream- Parameters:
inStream- the stream to wrap- Throws:
IOException
-
ZstdInputStreamNoFinalizer
create a new decompressing InputStream- Parameters:
inStream- the stream to wrapbufferPool- the pool to fetch and return buffers- Throws:
IOException
-
-
Method Details
-
recommendedDInSize
public static long recommendedDInSize() -
recommendedDOutSize
public static long recommendedDOutSize() -
createDStream
private static long createDStream() -
freeDStream
private static int freeDStream(long stream) -
initDStream
private int initDStream(long stream) -
decompressStream
private int decompressStream(long stream, byte[] dst, int dst_size, byte[] src, int src_size) -
setContinuous
Don't break on unfinished frames Use case: decompressing files that are not yet finished writing and compressing -
getContinuous
public boolean getContinuous() -
setDict
- Throws:
IOException
-
setDict
- Throws:
IOException
-
setLongMax
- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
readInternal
- Throws:
IOException
-
read
- Overrides:
readin classFilterInputStream- Throws:
IOException
-
available
- Overrides:
availablein classFilterInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupportedin classFilterInputStream
-
skip
- Overrides:
skipin classFilterInputStream- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classFilterInputStream- Throws:
IOException
-