Top Fields Constructors Methods
com.github.luben.zstd

public Class ZstdDirectBufferCompressingStreamNoFinalizer

extends Object
implements Closeable, Flushable
Class Inheritance
All Implemented Interfaces
java.io.Flushable, java.io.Closeable, java.lang.AutoCloseable
Imports
com.github.luben.zstd.util.Native, java.io.Closeable, .Flushable, .IOException, java.nio.ByteBuffer

Field Summary

Modifier and TypeField and Description
private boolean
private int
private byte[]
private ZstdDictCompress
private boolean
private int
private int
private final long
private ByteBuffer

Constructor Summary

AccessConstructor and Description
public

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.
public void
private native long
compressDirectByteBuffer(long ctx, ByteBuffer dst, int dstOffset, int dstSize, ByteBuffer src, int srcOffset, int srcSize)

private static native long
private native long
endStream(long ctx, ByteBuffer dst, int dstOffset, int dstSize)

public void
flush()

Implements java.io.Flushable.flush.

Flushes this stream by writing any buffered output to the underlying stream.
protected ByteBuffer

Returns:

the new buffer to use, for most cases the same as the one passed in, after a call to ByteBuffer#clear().
flushBuffer
(ByteBuffer
buffer that has to be flushed (or most cases, you want to call ByteBuffer#flip() first)
toFlush
)

This method should flush the buffer and either return the same buffer (but cleared) or a new buffer that should be used from then on.

private native long
flushStream(long ctx, ByteBuffer dst, int dstOffset, int dstSize)

private static native long
freeCStream(long ctx)

private native long
initCStream(long ctx, int level)

private native long
initCStreamWithDict(long ctx, byte[] dict, int dict_size, int level)

private native long
private static native long
public static int
public ZstdDirectBufferCompressingStreamNoFinalizer
setDict(byte[] dict)

public ZstdDirectBufferCompressingStreamNoFinalizer
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closedback to summary
private boolean closed
consumedback to summary
private int consumed
dictback to summary
private byte[] dict
fastDictback to summary
private ZstdDictCompress fastDict
initializedback to summary
private boolean initialized
levelback to summary
private int level
producedback to summary
private int produced
streamback to summary
private final long stream
targetback to summary
private ByteBuffer target

Constructor Detail

ZstdDirectBufferCompressingStreamNoFinalizerback to summary
public ZstdDirectBufferCompressingStreamNoFinalizer(ByteBuffer target, int level) throws IOException

Method Detail

closeback to summary
public void close() throws IOException

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
Exceptions
IOException:
if an I/O error occurs
compressback to summary
public void compress(ByteBuffer source) throws IOException
compressDirectByteBufferback to summary
private native long compressDirectByteBuffer(long ctx, ByteBuffer dst, int dstOffset, int dstSize, ByteBuffer src, int srcOffset, int srcSize)
createCStreamback to summary
private static native long createCStream()
endStreamback to summary
private native long endStream(long ctx, ByteBuffer dst, int dstOffset, int dstSize)
flushback to summary
public void flush() throws IOException

Implements java.io.Flushable.flush.

Doc from java.io.Flushable.flush.

Flushes this stream by writing any buffered output to the underlying stream.

Annotations
@Override
Exceptions
IOException:
If an I/O error occurs
flushBufferback to summary
protected ByteBuffer flushBuffer(ByteBuffer toFlush) throws IOException

This method should flush the buffer and either return the same buffer (but cleared) or a new buffer that should be used from then on.

Parameters
toFlush:ByteBuffer

buffer that has to be flushed (or most cases, you want to call ByteBuffer#flip() first)

Returns:ByteBuffer

the new buffer to use, for most cases the same as the one passed in, after a call to ByteBuffer#clear().

flushStreamback to summary
private native long flushStream(long ctx, ByteBuffer dst, int dstOffset, int dstSize)
freeCStreamback to summary
private static native long freeCStream(long ctx)
initCStreamback to summary
private native long initCStream(long ctx, int level)
initCStreamWithDictback to summary
private native long initCStreamWithDict(long ctx, byte[] dict, int dict_size, int level)
initCStreamWithFastDictback to summary
private native long initCStreamWithFastDict(long ctx, ZstdDictCompress dict)
recommendedCOutSizeback to summary
private static native long recommendedCOutSize()
recommendedOutputBufferSizeback to summary
public static int recommendedOutputBufferSize()
setDictback to summary
public ZstdDirectBufferCompressingStreamNoFinalizer setDict(byte[] dict)
setDictback to summary
public ZstdDirectBufferCompressingStreamNoFinalizer setDict(ZstdDictCompress dict)