Package com.github.luben.zstd
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 BufferPool
private long
private boolean
private boolean
private boolean
private boolean
private final byte[]
private static final int
private final ByteBuffer
private long
private long
private final long
Fields inherited from class java.io.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 TypeMethodDescriptionint
void
close()
private static long
private int
decompressStream
(long stream, byte[] dst, int dst_size, byte[] src, int src_size) private static int
freeDStream
(long stream) boolean
private int
initDStream
(long stream) boolean
int
read()
int
read
(byte[] dst, int offset, int len) (package private) int
readInternal
(byte[] dst, int offset, int len) static long
static long
setContinuous
(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) long
skip
(long numBytes) Methods inherited from class java.io.FilterInputStream
mark, read, reset
Methods inherited from class java.io.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:
read
in classFilterInputStream
- Throws:
IOException
-
readInternal
- Throws:
IOException
-
read
- Overrides:
read
in classFilterInputStream
- Throws:
IOException
-
available
- Overrides:
available
in classFilterInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()- Overrides:
markSupported
in classFilterInputStream
-
skip
- Overrides:
skip
in classFilterInputStream
- Throws:
IOException
-
close
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classFilterInputStream
- Throws:
IOException
-