Package com.github.luben.zstd
Class ZstdDirectBufferDecompressingStreamNoFinalizer
- java.lang.Object
-
- com.github.luben.zstd.BaseZstdBufferDecompressingStreamNoFinalizer
-
- com.github.luben.zstd.ZstdDirectBufferDecompressingStreamNoFinalizer
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
public class ZstdDirectBufferDecompressingStreamNoFinalizer extends BaseZstdBufferDecompressingStreamNoFinalizer
-
-
Field Summary
-
Fields inherited from class com.github.luben.zstd.BaseZstdBufferDecompressingStreamNoFinalizer
closed, source, stream
-
-
Constructor Summary
Constructors Constructor Description ZstdDirectBufferDecompressingStreamNoFinalizer(java.nio.ByteBuffer source)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
read(java.nio.ByteBuffer target)
Reads the content of the de-compressed stream into the target buffer.static int
recommendedTargetBufferSize()
-
Methods inherited from class com.github.luben.zstd.BaseZstdBufferDecompressingStreamNoFinalizer
close, hasRemaining, refill, setDict, setDict, setLongMax
-
-
-
-
Method Detail
-
read
public int read(java.nio.ByteBuffer target) throws java.io.IOException
Description copied from class:BaseZstdBufferDecompressingStreamNoFinalizer
Reads the content of the de-compressed stream into the target buffer.This method will block until the chunk of compressed data stored in
BaseZstdBufferDecompressingStreamNoFinalizer.source
has been decompressed and written into the target buffer. After each execution, this method will refill theBaseZstdBufferDecompressingStreamNoFinalizer.source
buffer, usingBaseZstdBufferDecompressingStreamNoFinalizer.refill(ByteBuffer)
.To read the full stream of decompressed data, this method should be called in a loop while
BaseZstdBufferDecompressingStreamNoFinalizer.hasRemaining()
istrue
.The target buffer will be written starting from
Buffer.position()
. TheBuffer.position()
of source and the target buffers will be modified to represent the data read and written respectively.- Specified by:
read
in classBaseZstdBufferDecompressingStreamNoFinalizer
- Parameters:
target
- buffer to store the read bytes from uncompressed stream.- Returns:
- the number of bytes read into the target buffer.
- Throws:
ZstdIOException
- if an error occurs while reading.java.io.IOException
- if the stream is closed before reading.
-
recommendedTargetBufferSize
public static int recommendedTargetBufferSize()
-
-