Top Inners Constructors Methods
com.github.luben.zstd

public Class Zstd

extends Object
Class Inheritance
Imports
java.nio.ByteBuffer, java.util.Arrays, com.github.luben.zstd.util.Native, com.github.luben.zstd.ZstdCompressCtx, .ZstdDecompressCtx

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum
Zstd.ParamSwitch

Note

This enum controls features which are conditionally beneficial.

Constructor Summary

AccessConstructor and Description
public
Zstd()

Method Summary

Modifier and TypeMethod and Description
public static native int
public static native int
public static native int
public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compress
(byte[]
the destination buffer
dst
,
byte[]
the source buffer
src
,
int
compression level
level
,
boolean
flag to enable or disable checksum
checksumFlag
)

Compresses buffer 'src' into buffer 'dst'.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compress
(byte[]
the destination buffer
dst
,
byte[]
the source buffer
src
,
int
compression level
level
)

Compresses buffer 'src' into buffer 'dst'.

public static long
compress(byte[] dst, byte[] src, ZstdDictCompress dict)

public static byte[]

Returns:

byte array with the compressed data
compress
(byte[]
the source buffer
src
)

Compresses the data in buffer 'src' using default compression level

public static byte[]

Returns:

byte array with the compressed data
compress
(byte[]
the source buffer
src
,
int
compression level
level
)

Compresses the data in buffer 'src'

public static int

Returns:

the size of the compressed data
compress
(ByteBuffer
the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset at which the compressed data are to be written, and that the limit() of this buffer is the maximum compressed data size to allow.

When this method returns successfully, dstBuf's position() will be set to its current position() plus the compressed size of the data.

dstBuf
,
ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the uncompressed data to be compressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuf's position() will be set to its limit().

srcBuf
)

Compresses the data in buffer 'srcBuf' using default compression level

public static int

Returns:

the size of the compressed data
compress
(ByteBuffer
the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset at which the compressed data are to be written, and that the limit() of this buffer is the maximum compressed data size to allow.

When this method returns successfully, dstBuf's position() will be set to its current position() plus the compressed size of the data.

dstBuf
,
ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the uncompressed data to be compressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuf's position() will be set to its limit().

srcBuf
,
int
compression level
level
,
boolean checksumFlag)

Compresses the data in buffer 'srcBuf'

public static int
compress(ByteBuffer dstBuf, ByteBuffer srcBuf, int level)

public static ByteBuffer

Returns:

A newly allocated direct ByteBuffer containing the compressed data.
compress
(ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the uncompressed data to be compressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuf's position() will be set to its limit().

srcBuf
,
int
compression level
level
)

Compresses the data in buffer 'srcBuf'

public static byte[]

Returns:

byte array with the compressed data
compress
(byte[]
the source buffer
src
,
ZstdDictCompress
dictionary to use
dict
)

Compresses the data in buffer 'src'

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compress
(byte[]
the destination buffer
dst
,
byte[]
the source buffer
src
,
byte[]
the dictionary buffer
dict
,
int
compression level
level
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static int

Returns:

the number of bytes written into buffer 'dstBuff'
compress
(ByteBuffer
the destination buffer
dstBuff
,
ByteBuffer
the source buffer
srcBuff
,
byte[]
the dictionary buffer
dict
,
int
compression level
level
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static ByteBuffer

Returns:

compressed direct byte buffer
compress
(ByteBuffer
the source buffer
srcBuff
,
byte[]
the dictionary buffer
dict
,
int
compression level
level
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static int

Returns:

the number of bytes written into buffer 'dstBuff'
compress
(ByteBuffer
the destination buffer
dstBuff
,
ByteBuffer
the source buffer
srcBuff
,
ZstdDictCompress
the dictionary buffer
dict
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static ByteBuffer

Returns:

compressed direct byte buffer
compress
(ByteBuffer
the source buffer
srcBuff
,
ZstdDictCompress
the dictionary buffer
dict
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static native long

Returns:

the maximum size of the compressed data
compressBound
(long
the size of the data to be compressed
srcSize
)

Maximum size of the compressed data

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressByteArray
(byte[]
the destination buffer
dst
,
int
offset from the start of the destination buffer
dstOffset
,
int
available space in the destination buffer after the offset
dstSize
,
byte[]
the source buffer
src
,
int
offset from the start of the source buffer
srcOffset
,
int
available data in the source buffer after the offset
srcSize
,
int
compression level
level
,
boolean
flag to enable or disable checksum
checksumFlag
)

Compresses buffer 'src' into buffer 'dst'.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressByteArray
(byte[]
the destination buffer
dst
,
int
offset from the start of the destination buffer
dstOffset
,
int
available space in the destination buffer after the offset
dstSize
,
byte[]
the source buffer
src
,
int
offset from the start of the source buffer
srcOffset
,
int
available data in the source buffer after the offset
srcSize
,
int
compression level
level
)

Compresses buffer 'src' into buffer 'dst'.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressDirectByteBuffer
(ByteBuffer
the destination buffer
dst
,
int
offset from the start of the destination buffer
dstOffset
,
int
available space in the destination buffer after the offset
dstSize
,
ByteBuffer
the source buffer
src
,
int
offset from the start of the source buffer
srcOffset
,
int
available data in the source buffer after the offset
srcSize
,
int
compression level
level
,
boolean
flag to enable or disable checksum
checksumFlag
)

Compresses direct buffer 'src' into direct buffer 'dst'.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressDirectByteBuffer
(ByteBuffer
the destination buffer
dst
,
int
offset from the start of the destination buffer
dstOffset
,
int
available space in the destination buffer after the offset
dstSize
,
ByteBuffer
the source buffer
src
,
int
offset from the start of the source buffer
srcOffset
,
int
available data in the source buffer after the offset
srcSize
,
int
compression level
level
)

Compresses direct buffer 'src' into direct buffer 'dst'.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressDirectByteBufferFastDict
(ByteBuffer
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
int
the size of 'dst'
dstSize
,
ByteBuffer
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the length of 'src'
srcSize
,
ZstdDictCompress
the dictionary
dict
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressDirectByteBufferUsingDict
(ByteBuffer
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
int
size of 'dst'
dstSize
,
ByteBuffer
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the length of 'src'
srcSize
,
byte[]
the dictionary buffer
dict
,
int
compression level
level
)

Compresses direct byte buffer 'src' into direct byte buffer 'dst' with dictionary.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressFastDict
(byte[]
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
byte[]
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the length of available data in 'src' after `srcOffset'
length
,
ZstdDictCompress
the dictionary
dict
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressFastDict
(byte[]
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
byte[]
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
ZstdDictCompress
the dictionary
dict
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static native long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressUnsafe
(long
pointer to the destination buffer
dst
,
long
available space in the destination buffer
dstSize
,
long
pointer to the source buffer
src
,
long
available data in the source buffer
srcSize
,
int
compression level
level
,
boolean
flag to enable or disable checksum
checksumFlag
)

Compresses buffer 'src' into direct buffer 'dst'.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressUnsafe
(long
pointer to the destination buffer
dst
,
long
available space in the destination buffer
dstSize
,
long
pointer to the source buffer
src
,
long
available data in the source buffer
srcSize
,
int
compression level
level
)

Compresses buffer 'src' into direct buffer 'dst'.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressUsingDict
(byte[]
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
byte[]
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the length of available data in 'src' after `srcOffset'
length
,
byte[]
the dictionary buffer
dict
,
int
compression level
level
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static long

Returns:

the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
compressUsingDict
(byte[]
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
byte[]
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
byte[]
the dictionary buffer
dict
,
int
compression level
level
)

Compresses buffer 'src' into buffer 'dst' with dictionary.

public static long
compressUsingDict(byte[] dst, byte[] src, byte[] dict, int level)

Deprecated Use compress(dst, src, dict, level) instead
Compresses buffer 'src' into buffer 'dst' with dictionary.
public static byte[]

Returns:

compressed byte array
compressUsingDict
(byte[]
the source buffer
src
,
byte[]
the dictionary buffer
dict
,
int
compression level
level
)

Compresses buffer 'src' with dictionary.

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompress
(byte[]
the destination buffer
dst
,
byte[]
the source buffer
src
)

Decompresses buffer 'src' into buffer 'dst'.

public static byte[]

Returns:

byte array with the decompressed data
decompress
(byte[]
the source buffer
src
,
int
the maximum size of the uncompressed data. If originaSize is greater than the actuall uncompressed size, additional memory copy going to happen. If originalSize is smaller than the uncompressed size, ZstdExeption will be thrown.
originalSize
)

Decompress data

public static int

Returns:

the size of the decompressed data.
decompress
(ByteBuffer
the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset at which the decompressed data are to be written, and that the limit() of this buffer is the maximum decompressed data size to allow.

When this method returns successfully, dstBuf's position() will be set to its current position() plus the decompressed size of the data.

dstBuf
,
ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data to be decompressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuf's position() will be set to its limit().

srcBuf
)

Decompress data

public static ByteBuffer

Returns:

A newly-allocated ByteBuffer containing the decompressed data. The position() of this buffer will be 0, and the limit() will be the size of the decompressed data. In other words the buffer is ready to be used for reading. Note that this is different behavior from the other decompress() overload which takes as a parameter the destination ByteBuffer.
decompress
(ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data to be decompressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuf's position() will be set to its limit().

srcBuf
,
int
the maximum size of the uncompressed data
originalSize
)

Decompress data

public static byte[]

Returns:

byte array with the decompressed data
decompress
(byte[]
the source buffer
src
,
ZstdDictDecompress
dictionary to use
dict
,
int
the maximum size of the uncompressed data
originalSize
)

Decompress data

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompress
(byte[]
the destination buffer
dst
,
byte[]
the source buffer
src
,
byte[]
the dictionary buffer
dict
)

Decompresses buffer 'src' into buffer 'dst' with dictionary.

public static byte[]

Returns:

byte array with the decompressed data
decompress
(byte[]
the source buffer
src
,
byte[]
dictionary to use
dict
,
int
the maximum size of the uncompressed data
originalSize
)

public static int

Returns:

the size of the decompressed data.
decompress
(ByteBuffer
the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset at which the decompressed data are to be written, and that the limit() of this buffer is the maximum decompressed data size to allow.

When this method returns successfully, dstBuff's position() will be set to its current position() plus the decompressed size of the data.

dstBuff
,
ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data to be decompressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuff's position() will be set to its limit().

srcBuff
,
byte[]
the dictionary buffer to use for compression
dict
)

Decompress data

public static ByteBuffer

Returns:

A newly-allocated ByteBuffer containing the decompressed data. The position() of this buffer will be 0, and the limit() will be the size of the decompressed data. In other words the buffer is ready to be used for reading. Note that this is different behavior from the other decompress() overload which takes as a parameter the destination ByteBuffer.
decompress
(ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data to be decompressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuff's position() will be set to its limit().

srcBuff
,
byte[]
the dictionary used in the compression
dict
,
int
the maximum size of the uncompressed data
originalSize
)

Decompress data

public static int

Returns:

the size of the decompressed data.
decompress
(ByteBuffer
the destination buffer. must be direct. It is assumed that the position() of this buffer marks the offset at which the decompressed data are to be written, and that the limit() of this buffer is the maximum decompressed data size to allow.

When this method returns successfully, dstBuff's position() will be set to its current position() plus the decompressed size of the data.

dstBuff
,
ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data to be decompressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuff's position() will be set to its limit().

srcBuff
,
ZstdDictDecompress
the dictionary buffer to use for compression
dict
)

Decompress data

public static ByteBuffer

Returns:

A newly-allocated ByteBuffer containing the decompressed data. The position() of this buffer will be 0, and the limit() will be the size of the decompressed data. In other words the buffer is ready to be used for reading. Note that this is different behavior from the other decompress() overload which takes as a parameter the destination ByteBuffer.
decompress
(ByteBuffer
the source buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data to be decompressed, and that the limit() of this buffer marks its end.

When this method returns successfully, srcBuff's position() will be set to its limit().

srcBuff
,
ZstdDictDecompress
the dictionary used in the compression
dict
,
int
the maximum size of the uncompressed data
originalSize
)

Decompress data

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompressByteArray
(byte[]
the destination buffer
dst
,
int
offset from the start of the destination buffer
dstOffset
,
int
available space in the destination buffer after the offset
dstSize
,
byte[]
the source buffer
src
,
int
offset from the start of the source buffer
srcOffset
,
int
available data in the source buffer after the offset
srcSize
)

Decompresses buffer 'src' into buffer 'dst'.

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompressDirectByteBuffer
(ByteBuffer
the destination buffer
dst
,
int
offset from the start of the destination buffer
dstOffset
,
int
available space in the destination buffer after the offset
dstSize
,
ByteBuffer
the source buffer
src
,
int
offset from the start of the source buffer
srcOffset
,
int
available data in the source buffer after the offset
srcSize
)

Decompresses direct buffer 'src' into direct buffer 'dst'.

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompressDirectByteBufferFastDict
(ByteBuffer
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
int
the size of 'dst'
dstSize
,
ByteBuffer
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the size of 'src'
srcSize
,
ZstdDictDecompress
the dictionary
dict
)

Decompresses buffer 'src' into buffer 'dst' with dictionary.

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompressDirectByteBufferUsingDict
(ByteBuffer
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
int
size of 'dst'
dstSize
,
ByteBuffer
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the size of 'src'
srcSize
,
byte[]
the dictionary buffer
dict
)

Decompresses buffer 'src' into buffer 'dst' with dictionary.

public static native long

Returns:

the number of bytes of the original buffer 0 if the original size is not known
decompressedDirectByteBufferSize
(ByteBuffer
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffe
srcSize
,
boolean
whether the buffer contains a magicless frame
magicless
)

Deprecated Use `getDirectByteBufferFrameContentSize` to also return error codes from zstd
Return the original size of a compressed buffer (if known)
public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known
decompressedDirectByteBufferSize
(ByteBuffer
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffe
srcSize
)

Deprecated Use `getDirectByteBufferFrameContentSize` that return also the errors
Return the original size of a compressed buffer (if known)
public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known
decompressedSize
(byte[]
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffer
srcSize
,
boolean
whether the buffer contains a magicless frame
magicless
)

Deprecated Use `getFrameContentSize` to also return error codes from zstd
Return the original size of a compressed buffer (if known)
public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known
decompressedSize
(byte[]
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffer
srcSize
)

Deprecated Use `getFrameContentSize` to also return error codes from zstd
Return the original size of a compressed buffer (if known)
public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known
decompressedSize
(byte[]
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
)

Deprecated Use `getFrameContentSize` to also return error codes from zstd
Return the original size of a compressed buffer (if known)
public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known
decompressedSize
(byte[]
the compressed buffer
src
)

Deprecated Use `getFrameContentSize` to also return error codes from zstd
Return the original size of a compressed buffer (if known)
public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known
decompressedSize
(ByteBuffer
the compressed buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data whose decompressed size is being queried, and that the limit() of this buffer marks its end.
srcBuf
)

Deprecated Use `getDirectByteBufferFrameContentSize` that return also the errors
Return the original size of a compressed buffer (if known)
private static native long
decompressedSize0(byte[] src, int srcPosition, int srcSize, boolean magicless)

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompressFastDict
(byte[]
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
byte[]
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the length of 'src'
length
,
ZstdDictDecompress
the dictionary
dict
)

Decompresses buffer 'src' into buffer 'dst' with dictionary.

public static native long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompressUnsafe
(long
pointer to the destination buffer
dst
,
long
available space in the destination buffer after the offset
dstSize
,
long
pointer the source buffer
src
,
long
available data in the source buffer after the offset
srcSize
)

Decompresses buffer 'src' into direct buffer 'dst'.

public static long

Returns:

the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
decompressUsingDict
(byte[]
the destination buffer
dst
,
int
the start offset of 'dst'
dstOffset
,
byte[]
the source buffer
src
,
int
the start offset of 'src'
srcOffset
,
int
the length of 'src'
length
,
byte[]
the dictionary buffer
dict
)

Decompresses buffer 'src' into buffer 'dst' with dictionary.

public static long
decompressUsingDict(byte[] dst, byte[] src, byte[] dict)

Deprecated Use decompress(dst, src, dict) instead
Decompresses buffer 'src' into buffer 'dst' with dictionary.
public static native int
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
public static native long
pack-priv static final byte[]
pack-priv static native void
generateSequences(long stream, long outSeqs, long outSeqsSize, long src, long srcSize)

pack-priv static native long
public static native long

Returns:

DictId or 0 if not available
getDictIdFromDict
(byte[]
dictionary
dict
)

Get DictId of a dictionary

private static native long
getDictIdFromDictDirect(ByteBuffer dict, int offset, int length)

public static long

Returns:

DictId or 0 if not available
getDictIdFromDictDirect
(ByteBuffer
dictionary as Direct ByteBuffer
dict
)

Get DictId of a dictionary

public static native long

Returns:

DictId or 0 if not available
getDictIdFromFrame
(byte[]
compressed frame
src
)

Get DictId from a compressed frame

public static native long

Returns:

DictId or 0 if not available
getDictIdFromFrameBuffer
(ByteBuffer
compressed frame
src
)

Get DictId from a compressed ByteBuffer frame

public static native long

Returns:

the number of bytes of the original buffer 0 if the original size is not known negative if there is an error decoding the frame header
getDirectByteBufferFrameContentSize
(ByteBuffer
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffe
srcSize
,
boolean
whether the buffer contains a magicless frame
magicless
)

Return the original size of a compressed buffer (if known)

public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known negative if there is an error decoding the frame header
getDirectByteBufferFrameContentSize
(ByteBuffer
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffe
srcSize
)

Return the original size of a compressed buffer (if known)

public static native long
getErrorCode(long code)

public static native String
getErrorName(long code)

public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known, negative if there is an error decoding the frame header
getFrameContentSize
(byte[]
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffer
srcSize
,
boolean
whether the buffer contains a magicless frame
magicless
)

Return the original size of a compressed buffer (if known)

public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known, negative if there is an error decoding the frame header
getFrameContentSize
(byte[]
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
,
int
length of the compressed data inside the src buffer
srcSize
)

Return the original size of a compressed buffer (if known)

public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known, negative if there is an error decoding the frame header
getFrameContentSize
(byte[]
the compressed buffer
src
,
int
offset of the compressed data inside the src buffer
srcPosition
)

Return the original size of a compressed buffer (if known)

public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known, negative if there is an error decoding the frame header
getFrameContentSize
(byte[]
the compressed buffer
src
)

Return the original size of a compressed buffer (if known)

public static long

Returns:

the number of bytes of the original buffer 0 if the original size is not known negative if there is an error decoding the frame header
getFrameContentSize
(ByteBuffer
the compressed buffer. must be direct. It is assumed that the position() of this buffer marks the beginning of the compressed data whose decompressed size is being queried, and that the limit() of this buffer marks its end.
srcBuf
)

Return the original size of a compressed buffer (if known)

private static native long
getFrameContentSize0(byte[] src, int srcPosition, int srcSize, boolean magicless)

pack-priv static native long
public static native int
public static native int
public static native boolean

Returns:

if the return code signals an error
isError
(long
return code/size
code
)

Error handling

public static native int
loadDictCompress(long stream, byte[] dict, int dict_size)

public static native int
loadDictDecompress(long stream, byte[] dict, int dict_size)

public static native int
public static native int
public static native int
public static native int
public static native int
public static native void
registerSequenceProducer(long stream, long seqProdState, long seqProdFunction)

public static native int
public static native int
public static native int
public static native int
public static native int
setCompressionChainLog(long stream, int chainLog)

public static native int
setCompressionChecksums(long stream, boolean useChecksums)

public static native int
setCompressionHashLog(long stream, int hashLog)

public static native int
setCompressionJobSize(long stream, int jobSize)

public static native int
setCompressionLevel(long stream, int level)

public static native int
setCompressionLong(long stream, int windowLog)

public static native int
setCompressionMagicless(long stream, boolean useMagicless)

public static native int
setCompressionMinMatch(long stream, int minMatch)

public static native int
setCompressionOverlapLog(long stream, int overlapLog)

public static native int
setCompressionSearchLog(long stream, int searchLog)

public static native int
setCompressionStrategy(long stream, int strategy)

public static native int
setCompressionTargetLength(long stream, int targetLength)

public static native int
setCompressionWindowLog(long stream, int windowLog)

public static native int
setCompressionWorkers(long stream, int workers)

public static native int
setDecompressionLongMax(long stream, int windowLogMax)

public static native int
setDecompressionMagicless(long stream, boolean useMagicless)

public static native int
setEnableLongDistanceMatching(long stream, int enableLDM)

public static native int
setRefMultipleDDicts(long stream, boolean useMultiple)

public static native int
setSearchForExternalRepcodes(long stream, int searchRepcodes)

public static native int
setSequenceProducerFallback(long stream, boolean fallbackFlag)

public static native int
setValidateSequences(long stream, int validateSequences)

public static long

Returns:

the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
trainFromBuffer
(byte[][]
the samples buffer array
samples
,
byte[]
the new dictionary buffer
dictBuffer
,
boolean
use the legacy training algorithm; otherwise cover
legacy
)

Creates a new dictionary to tune a kind of samples

public static long

Returns:

the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
trainFromBuffer
(byte[][]
the samples buffer array
samples
,
byte[]
the new dictionary buffer
dictBuffer
)

Creates a new dictionary to tune a kind of samples (uses Cover algorithm)

private static native long
trainFromBuffer0(byte[][] samples, byte[] dictBuffer, boolean legacy)

public static long

Returns:

the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
trainFromBufferDirect
(ByteBuffer
the samples direct byte buffer array
samples
,
int[]
java integer array of sizes
sampleSizes
,
ByteBuffer
the new dictionary buffer (preallocated direct byte buffer)
dictBuffer
,
boolean
use the legacy training algorithm; oter
legacy
)

Creates a new dictionary to tune a kind of samples

public static long

Returns:

the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
trainFromBufferDirect
(ByteBuffer
the samples direct byte buffer array
samples
,
int[]
java integer array of sizes
sampleSizes
,
ByteBuffer
the new dictionary buffer (preallocated direct byte buffer)
dictBuffer
)

Creates a new dictionary to tune a kind of samples (uses Cover algorithm)

private static native long
trainFromBufferDirect0(ByteBuffer samples, int[] sampleSizes, ByteBuffer dictBuffer, boolean legacy)

public static native int
public static native int
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait