Top Fields Constructors Methods
com.github.luben.zstd

public abstract Class BaseZstdBufferDecompressingStreamNoFinalizer

extends Object
implements Closeable
Class Inheritance
All Implemented Interfaces
java.io.Closeable, java.lang.AutoCloseable
Known Direct Subclasses
com.github.luben.zstd.ZstdBufferDecompressingStreamNoFinalizer, com.github.luben.zstd.ZstdDirectBufferDecompressingStreamNoFinalizer
Imports
java.io.Closeable, .IOException, java.nio.ByteBuffer

Field Summary

Modifier and TypeField and Description
protected boolean
private int
consumed

This field is set by the native call to represent the number of bytes consumed from source buffer.

private boolean
private int
produced

This field is set by the native call to represent the number of bytes produced into the target buffer.

protected ByteBuffer
protected long
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.
pack-priv abstract long
pack-priv abstract long
decompressStream(long stream, ByteBuffer dst, int dstOffset, int dstSize, ByteBuffer src, int srcOffset, int srcSize)

pack-priv abstract long
freeDStream(long stream)

public boolean

Returns:

false if all data is processed and no more data is available from the source
hasRemaining
()

pack-priv abstract long
initDStream(long stream)

public abstract int

Returns:

the number of bytes read into the target buffer.
read
(ByteBuffer
buffer to store the read bytes from uncompressed stream.
target
)

Reads the content of the de-compressed stream into the target buffer.

pack-priv int
readInternal(ByteBuffer target, boolean isDirectBufferRequired)

protected ByteBuffer

Returns:

either the current buffer (but refilled and flipped if there was new content) or a new buffer.
refill
(ByteBuffer
current buffer
toRefill
)

Override this method in case the byte buffer passed to the constructor might not contain the full compressed stream

public BaseZstdBufferDecompressingStreamNoFinalizer
setDict(byte[] dict)

public BaseZstdBufferDecompressingStreamNoFinalizer
public BaseZstdBufferDecompressingStreamNoFinalizer
setLongMax(int
window size in bytes
windowLogMax
)

Set the value of zstd parameter ZSTD_d_windowLogMax.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closedback to summary
protected boolean closed
consumedback to summary
private int consumed

This field is set by the native call to represent the number of bytes consumed from source buffer.

finishedFrameback to summary
private boolean finishedFrame
producedback to summary
private int produced

This field is set by the native call to represent the number of bytes produced into the target buffer.

sourceback to summary
protected ByteBuffer source
streamback to summary
protected long stream
streamEndback to summary
private boolean streamEnd

Constructor Detail

BaseZstdBufferDecompressingStreamNoFinalizerback to summary
pack-priv BaseZstdBufferDecompressingStreamNoFinalizer(ByteBuffer source)

Method Detail

closeback to summary
public void close()

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
createDStreamback to summary
pack-priv abstract long createDStream()
decompressStreamback to summary
pack-priv abstract long decompressStream(long stream, ByteBuffer dst, int dstOffset, int dstSize, ByteBuffer src, int srcOffset, int srcSize)
freeDStreamback to summary
pack-priv abstract long freeDStream(long stream)
hasRemainingback to summary
public boolean hasRemaining()
Returns:boolean

false if all data is processed and no more data is available from the source

initDStreamback to summary
pack-priv abstract long initDStream(long stream)
readback to summary
public abstract int read(ByteBuffer target) throws IOException

Reads the content of the de-compressed stream into the target buffer.

This method will block until the chunk of compressed data stored in source has been decompressed and written into the target buffer. After each execution, this method will refill the source buffer, using refill(ByteBuffer).

To read the full stream of decompressed data, this method should be called in a loop while hasRemaining() is true.

The target buffer will be written starting from ByteBuffer#position(). The ByteBuffer#position() of source and the target buffers will be modified to represent the data read and written respectively.

Parameters
target:ByteBuffer

buffer to store the read bytes from uncompressed stream.

Returns:int

the number of bytes read into the target buffer.

Exceptions
IOException:
if the stream is closed before reading.
ZstdIOException:
if an error occurs while reading.
IllegalArgumentException:
if provided source or target buffers are incorrectly configured.
readInternalback to summary
pack-priv int readInternal(ByteBuffer target, boolean isDirectBufferRequired) throws IOException
refillback to summary
protected ByteBuffer refill(ByteBuffer toRefill)

Override this method in case the byte buffer passed to the constructor might not contain the full compressed stream

Parameters
toRefill:ByteBuffer

current buffer

Returns:ByteBuffer

either the current buffer (but refilled and flipped if there was new content) or a new buffer.

setDictback to summary
public BaseZstdBufferDecompressingStreamNoFinalizer setDict(byte[] dict) throws IOException
setDictback to summary
public BaseZstdBufferDecompressingStreamNoFinalizer setDict(ZstdDictDecompress dict) throws IOException
setLongMaxback to summary
public BaseZstdBufferDecompressingStreamNoFinalizer setLongMax(int windowLogMax) throws IOException

Set the value of zstd parameter ZSTD_d_windowLogMax.

Parameters
windowLogMax:int

window size in bytes

Returns:BaseZstdBufferDecompressingStreamNoFinalizer

this instance of BaseZstdBufferDecompressingStreamNoFinalizer

Exceptions
ZstdIOException:
if there is an error while setting the configuration natively.
See Also
Zstd's ZSTD_d_windowLogMax parameter