Class Zstd
- java.lang.Object
-
- com.github.luben.zstd.Zstd
-
public class Zstd extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Zstd()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static intblockSizeMax()static intchainLogMax()static intchainLogMin()static byte[]compress(byte[] src)Compresses the data in buffer 'src' using default compression levelstatic longcompress(byte[] dst, byte[] src, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary.static longcompress(byte[] dst, byte[] src, int level)Compresses buffer 'src' into buffer 'dst'.static longcompress(byte[] dst, byte[] src, int level, boolean checksumFlag)Compresses buffer 'src' into buffer 'dst'.static longcompress(byte[] dst, byte[] src, ZstdDictCompress dict)static byte[]compress(byte[] src, int level)Compresses the data in buffer 'src'static byte[]compress(byte[] src, ZstdDictCompress dict)Compresses the data in buffer 'src'static java.nio.ByteBuffercompress(java.nio.ByteBuffer srcBuff, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary.static java.nio.ByteBuffercompress(java.nio.ByteBuffer srcBuf, int level)Compresses the data in buffer 'srcBuf'static java.nio.ByteBuffercompress(java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary.static intcompress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)Compresses the data in buffer 'srcBuf' using default compression levelstatic intcompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary.static intcompress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf, int level)static intcompress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf, int level, boolean checksumFlag)Compresses the data in buffer 'srcBuf'static intcompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary.static longcompressBound(long srcSize)Maximum size of the compressed datastatic longcompressByteArray(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize, int level)Compresses buffer 'src' into buffer 'dst'.static longcompressByteArray(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize, int level, boolean checksumFlag)Compresses buffer 'src' into buffer 'dst'.static longcompressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, int level)Compresses direct buffer 'src' into direct buffer 'dst'.static longcompressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, int level, boolean checksumFlag)Compresses direct buffer 'src' into direct buffer 'dst'.static longcompressDirectByteBufferFastDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary.static longcompressDirectByteBufferUsingDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, byte[] dict, int level)Compresses direct byte buffer 'src' into direct byte buffer 'dst' with dictionary.static longcompressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary.static longcompressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary.static longcompressUnsafe(long dst, long dstSize, long src, long srcSize, int level)Compresses buffer 'src' into direct buffer 'dst'.static longcompressUnsafe(long dst, long dstSize, long src, long srcSize, int level, boolean checksumFlag)Compresses buffer 'src' into direct buffer 'dst'.static longcompressUsingDict(byte[] dst, byte[] src, byte[] dict, int level)Deprecated.Use compress(dst, src, dict, level) insteadstatic byte[]compressUsingDict(byte[] src, byte[] dict, int level)Compresses buffer 'src' with dictionary.static longcompressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary.static longcompressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary.static longdecompress(byte[] dst, byte[] src)Decompresses buffer 'src' into buffer 'dst'.static longdecompress(byte[] dst, byte[] src, byte[] dict)Decompresses buffer 'src' into buffer 'dst' with dictionary.static byte[]decompress(byte[] src, byte[] dict, int originalSize)static byte[]decompress(byte[] src, int originalSize)Decompress datastatic byte[]decompress(byte[] src, ZstdDictDecompress dict, int originalSize)Decompress datastatic java.nio.ByteBufferdecompress(java.nio.ByteBuffer srcBuff, byte[] dict, int originalSize)Decompress datastatic java.nio.ByteBufferdecompress(java.nio.ByteBuffer srcBuf, int originalSize)Decompress datastatic java.nio.ByteBufferdecompress(java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict, int originalSize)Decompress datastatic intdecompress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)Decompress datastatic intdecompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict)Decompress datastatic intdecompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict)Decompress datastatic longdecompressByteArray(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize)Decompresses buffer 'src' into buffer 'dst'.static longdecompressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize)Decompresses direct buffer 'src' into direct buffer 'dst'.static longdecompressDirectByteBufferFastDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, ZstdDictDecompress dict)Decompresses buffer 'src' into buffer 'dst' with dictionary.static longdecompressDirectByteBufferUsingDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, byte[] dict)Decompresses buffer 'src' into buffer 'dst' with dictionary.static longdecompressedDirectByteBufferSize(java.nio.ByteBuffer src, int srcPosition, int srcSize)Deprecated.Use `getDirectByteBufferFrameContentSize` that return also the errorsstatic longdecompressedDirectByteBufferSize(java.nio.ByteBuffer src, int srcPosition, int srcSize, boolean magicless)Deprecated.Use `getDirectByteBufferFrameContentSize` to also return error codes from zstdstatic longdecompressedSize(byte[] src)Deprecated.Use `getFrameContentSize` to also return error codes from zstdstatic longdecompressedSize(byte[] src, int srcPosition)Deprecated.Use `getFrameContentSize` to also return error codes from zstdstatic longdecompressedSize(byte[] src, int srcPosition, int srcSize)Deprecated.Use `getFrameContentSize` to also return error codes from zstdstatic longdecompressedSize(byte[] src, int srcPosition, int srcSize, boolean magicless)Deprecated.Use `getFrameContentSize` to also return error codes from zstdstatic longdecompressedSize(java.nio.ByteBuffer srcBuf)Deprecated.Use `getDirectByteBufferFrameContentSize` that return also the errorsstatic longdecompressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictDecompress dict)Decompresses buffer 'src' into buffer 'dst' with dictionary.static longdecompressUnsafe(long dst, long dstSize, long src, long srcSize)Decompresses buffer 'src' into direct buffer 'dst'.static longdecompressUsingDict(byte[] dst, byte[] src, byte[] dict)Deprecated.Use decompress(dst, src, dict) insteadstatic longdecompressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, byte[] dict)Decompresses buffer 'src' into buffer 'dst' with dictionary.static intdefaultCompressionLevel()static longerrChecksumWrong()static longerrCorruptionDetected()static longerrDictionaryCorrupted()static longerrDictionaryCreationFailed()static longerrDictionaryWrong()static longerrDstBufferNull()static longerrDstSizeTooSmall()static longerrFrameParameterUnsupported()static longerrFrameParameterWindowTooLarge()static longerrGeneric()static longerrInitMissing()static longerrMaxSymbolValueTooLarge()static longerrMaxSymbolValueTooSmall()static longerrMemoryAllocation()static longerrNoError()static longerrParameterOutOfBound()static longerrParameterUnsupported()static longerrPrefixUnknown()static longerrSrcSizeWrong()static longerrStageWrong()static longerrTableLogTooLarge()static longerrVersionUnsupported()static longerrWorkSpaceTooSmall()static longgetDictIdFromDict(byte[] dict)Get DictId of a dictionarystatic longgetDictIdFromDictDirect(java.nio.ByteBuffer dict)Get DictId of a dictionarystatic longgetDictIdFromFrame(byte[] src)Get DictId from a compressed framestatic longgetDictIdFromFrameBuffer(java.nio.ByteBuffer src)Get DictId from a compressed ByteBuffer framestatic longgetDirectByteBufferFrameContentSize(java.nio.ByteBuffer src, int srcPosition, int srcSize)Return the original size of a compressed buffer (if known)static longgetDirectByteBufferFrameContentSize(java.nio.ByteBuffer src, int srcPosition, int srcSize, boolean magicless)Return the original size of a compressed buffer (if known)static longgetErrorCode(long code)static java.lang.StringgetErrorName(long code)static longgetFrameContentSize(byte[] src)Return the original size of a compressed buffer (if known)static longgetFrameContentSize(byte[] src, int srcPosition)Return the original size of a compressed buffer (if known)static longgetFrameContentSize(byte[] src, int srcPosition, int srcSize)Return the original size of a compressed buffer (if known)static longgetFrameContentSize(byte[] src, int srcPosition, int srcSize, boolean magicless)Return the original size of a compressed buffer (if known)static longgetFrameContentSize(java.nio.ByteBuffer srcBuf)Return the original size of a compressed buffer (if known)static inthashLogMax()static inthashLogMin()static booleanisError(long code)Error handlingstatic intloadDictCompress(long stream, byte[] dict, int dict_size)static intloadDictDecompress(long stream, byte[] dict, int dict_size)static intloadFastDictCompress(long stream, ZstdDictCompress dict)static intloadFastDictDecompress(long stream, ZstdDictDecompress dict)static intmagicNumber()static intmaxCompressionLevel()static intminCompressionLevel()static intsearchLengthMax()static intsearchLengthMin()static intsearchLogMax()static intsearchLogMin()static intsetCompressionChainLog(long stream, int chainLog)static intsetCompressionChecksums(long stream, boolean useChecksums)static intsetCompressionHashLog(long stream, int hashLog)static intsetCompressionJobSize(long stream, int jobSize)static intsetCompressionLevel(long stream, int level)static intsetCompressionLong(long stream, int windowLog)static intsetCompressionMagicless(long stream, boolean useMagicless)static intsetCompressionMinMatch(long stream, int minMatch)static intsetCompressionOverlapLog(long stream, int overlapLog)static intsetCompressionSearchLog(long stream, int searchLog)static intsetCompressionStrategy(long stream, int strategy)static intsetCompressionTargetLength(long stream, int targetLength)static intsetCompressionWindowLog(long stream, int windowLog)static intsetCompressionWorkers(long stream, int workers)static intsetDecompressionLongMax(long stream, int windowLogMax)static intsetDecompressionMagicless(long stream, boolean useMagicless)static intsetRefMultipleDDicts(long stream, boolean useMultiple)static longtrainFromBuffer(byte[][] samples, byte[] dictBuffer)Creates a new dictionary to tune a kind of samples (uses Cover algorithm)static longtrainFromBuffer(byte[][] samples, byte[] dictBuffer, boolean legacy)Creates a new dictionary to tune a kind of samplesstatic longtrainFromBufferDirect(java.nio.ByteBuffer samples, int[] sampleSizes, java.nio.ByteBuffer dictBuffer)Creates a new dictionary to tune a kind of samples (uses Cover algorithm)static longtrainFromBufferDirect(java.nio.ByteBuffer samples, int[] sampleSizes, java.nio.ByteBuffer dictBuffer, boolean legacy)Creates a new dictionary to tune a kind of samplesstatic intwindowLogMax()static intwindowLogMin()
-
-
-
Method Detail
-
compress
public static long compress(byte[] dst, byte[] src, int level, boolean checksumFlag)Compresses buffer 'src' into buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination buffersrc- the source bufferlevel- compression levelchecksumFlag- flag to enable or disable checksum- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compress
public static long compress(byte[] dst, byte[] src, int level)Compresses buffer 'src' into buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination buffersrc- the source bufferlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressByteArray
public static long compressByteArray(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize, int level, boolean checksumFlag)Compresses buffer 'src' into buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- offset from the start of the destination bufferdstSize- available space in the destination buffer after the offsetsrc- the source buffersrcOffset- offset from the start of the source buffersrcSize- available data in the source buffer after the offsetlevel- compression levelchecksumFlag- flag to enable or disable checksum- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressByteArray
public static long compressByteArray(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize, int level)Compresses buffer 'src' into buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- offset from the start of the destination bufferdstSize- available space in the destination buffer after the offsetsrc- the source buffersrcOffset- offset from the start of the source buffersrcSize- available data in the source buffer after the offsetlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressDirectByteBuffer
public static long compressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, int level, boolean checksumFlag)Compresses direct buffer 'src' into direct buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- offset from the start of the destination bufferdstSize- available space in the destination buffer after the offsetsrc- the source buffersrcOffset- offset from the start of the source buffersrcSize- available data in the source buffer after the offsetlevel- compression levelchecksumFlag- flag to enable or disable checksum- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressDirectByteBuffer
public static long compressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, int level)Compresses direct buffer 'src' into direct buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- offset from the start of the destination bufferdstSize- available space in the destination buffer after the offsetsrc- the source buffersrcOffset- offset from the start of the source buffersrcSize- available data in the source buffer after the offsetlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressUnsafe
public static long compressUnsafe(long dst, long dstSize, long src, long srcSize, int level, boolean checksumFlag)Compresses buffer 'src' into direct buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- pointer to the destination bufferdstSize- available space in the destination buffersrc- pointer to the source buffersrcSize- available data in the source bufferlevel- compression levelchecksumFlag- flag to enable or disable checksum- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressUnsafe
public static long compressUnsafe(long dst, long dstSize, long src, long srcSize, int level)Compresses buffer 'src' into direct buffer 'dst'. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- pointer to the destination bufferdstSize- available space in the destination buffersrc- pointer to the source buffersrcSize- available data in the source bufferlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressUsingDict
public static long compressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'src- the source buffersrcOffset- the start offset of 'src'length- the length of available data in 'src' after `srcOffset'dict- the dictionary bufferlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressUsingDict
public static long compressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'src- the source buffersrcOffset- the start offset of 'src'dict- the dictionary bufferlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressDirectByteBufferUsingDict
public static long compressDirectByteBufferUsingDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, byte[] dict, int level)Compresses direct byte buffer 'src' into direct byte buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'dstSize- size of 'dst'src- the source buffersrcOffset- the start offset of 'src'srcSize- the length of 'src'dict- the dictionary bufferlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressFastDict
public static long compressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'src- the source buffersrcOffset- the start offset of 'src'length- the length of available data in 'src' after `srcOffset'dict- the dictionary- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compressFastDict
public static long compressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'src- the source buffersrcOffset- the start offset of 'src'dict- the dictionary- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compress
public static long compress(byte[] dst, byte[] src, ZstdDictCompress dict)
-
compressDirectByteBufferFastDict
public static long compressDirectByteBufferFastDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'dstSize- the size of 'dst'src- the source buffersrcOffset- the start offset of 'src'srcSize- the length of 'src'dict- the dictionary- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
decompress
public static long decompress(byte[] dst, byte[] src)Decompresses buffer 'src' into buffer 'dst'. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination buffersrc- the source buffer- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompressByteArray
public static long decompressByteArray(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize)Decompresses buffer 'src' into buffer 'dst'. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination bufferdstOffset- offset from the start of the destination bufferdstSize- available space in the destination buffer after the offsetsrc- the source buffersrcOffset- offset from the start of the source buffersrcSize- available data in the source buffer after the offset- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompressDirectByteBuffer
public static long decompressDirectByteBuffer(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize)Decompresses direct buffer 'src' into direct buffer 'dst'. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination bufferdstOffset- offset from the start of the destination bufferdstSize- available space in the destination buffer after the offsetsrc- the source buffersrcOffset- offset from the start of the source buffersrcSize- available data in the source buffer after the offset- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompressUnsafe
public static long decompressUnsafe(long dst, long dstSize, long src, long srcSize)Decompresses buffer 'src' into direct buffer 'dst'. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- pointer to the destination bufferdstSize- available space in the destination buffer after the offsetsrc- pointer the source buffersrcSize- available data in the source buffer after the offset- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompressUsingDict
public static long decompressUsingDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, byte[] dict)Decompresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'src- the source buffersrcOffset- the start offset of 'src'length- the length of 'src'dict- the dictionary buffer- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompressDirectByteBufferUsingDict
public static long decompressDirectByteBufferUsingDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, byte[] dict)Decompresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'dstSize- size of 'dst'src- the source buffersrcOffset- the start offset of 'src'srcSize- the size of 'src'dict- the dictionary buffer- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompressFastDict
public static long decompressFastDict(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictDecompress dict)Decompresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'src- the source buffersrcOffset- the start offset of 'src'length- the length of 'src'dict- the dictionary- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompressDirectByteBufferFastDict
public static long decompressDirectByteBufferFastDict(java.nio.ByteBuffer dst, int dstOffset, int dstSize, java.nio.ByteBuffer src, int srcOffset, int srcSize, ZstdDictDecompress dict)Decompresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination bufferdstOffset- the start offset of 'dst'dstSize- the size of 'dst'src- the source buffersrcOffset- the start offset of 'src'srcSize- the size of 'src'dict- the dictionary- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
loadDictDecompress
public static int loadDictDecompress(long stream, byte[] dict, int dict_size)
-
loadFastDictDecompress
public static int loadFastDictDecompress(long stream, ZstdDictDecompress dict)
-
loadDictCompress
public static int loadDictCompress(long stream, byte[] dict, int dict_size)
-
loadFastDictCompress
public static int loadFastDictCompress(long stream, ZstdDictCompress dict)
-
setCompressionChecksums
public static int setCompressionChecksums(long stream, boolean useChecksums)
-
setCompressionMagicless
public static int setCompressionMagicless(long stream, boolean useMagicless)
-
setCompressionLevel
public static int setCompressionLevel(long stream, int level)
-
setCompressionLong
public static int setCompressionLong(long stream, int windowLog)
-
setCompressionWorkers
public static int setCompressionWorkers(long stream, int workers)
-
setCompressionOverlapLog
public static int setCompressionOverlapLog(long stream, int overlapLog)
-
setCompressionJobSize
public static int setCompressionJobSize(long stream, int jobSize)
-
setCompressionTargetLength
public static int setCompressionTargetLength(long stream, int targetLength)
-
setCompressionMinMatch
public static int setCompressionMinMatch(long stream, int minMatch)
-
setCompressionSearchLog
public static int setCompressionSearchLog(long stream, int searchLog)
-
setCompressionChainLog
public static int setCompressionChainLog(long stream, int chainLog)
-
setCompressionHashLog
public static int setCompressionHashLog(long stream, int hashLog)
-
setCompressionWindowLog
public static int setCompressionWindowLog(long stream, int windowLog)
-
setCompressionStrategy
public static int setCompressionStrategy(long stream, int strategy)
-
setDecompressionLongMax
public static int setDecompressionLongMax(long stream, int windowLogMax)
-
setDecompressionMagicless
public static int setDecompressionMagicless(long stream, boolean useMagicless)
-
setRefMultipleDDicts
public static int setRefMultipleDDicts(long stream, boolean useMultiple)
-
getFrameContentSize
public static long getFrameContentSize(byte[] src, int srcPosition, int srcSize, boolean magicless)Return the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffermagicless- whether the buffer contains a magicless frame- 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
-
decompressedSize
@Deprecated public static long decompressedSize(byte[] src, int srcPosition, int srcSize, boolean magicless)Deprecated.Use `getFrameContentSize` to also return error codes from zstdReturn the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffermagicless- whether the buffer contains a magicless frame- Returns:
- the number of bytes of the original buffer 0 if the original size is not known
-
getFrameContentSize
public static long getFrameContentSize(byte[] src, int srcPosition, int srcSize)Return the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffer- 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
-
decompressedSize
@Deprecated public static long decompressedSize(byte[] src, int srcPosition, int srcSize)Deprecated.Use `getFrameContentSize` to also return error codes from zstdReturn the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffer- Returns:
- the number of bytes of the original buffer 0 if the original size is not known
-
getFrameContentSize
public static long getFrameContentSize(byte[] src, int srcPosition)Return the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffer- 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
-
decompressedSize
@Deprecated public static long decompressedSize(byte[] src, int srcPosition)Deprecated.Use `getFrameContentSize` to also return error codes from zstdReturn the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffer- Returns:
- the number of bytes of the original buffer 0 if the original size is not known
-
getFrameContentSize
public static long getFrameContentSize(byte[] src)
Return the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffer- 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
-
decompressedSize
@Deprecated public static long decompressedSize(byte[] src)
Deprecated.Use `getFrameContentSize` to also return error codes from zstdReturn the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffer- Returns:
- the number of bytes of the original buffer 0 if the original size is not known
-
decompressedDirectByteBufferSize
@Deprecated public static long decompressedDirectByteBufferSize(java.nio.ByteBuffer src, int srcPosition, int srcSize, boolean magicless)Deprecated.Use `getDirectByteBufferFrameContentSize` to also return error codes from zstdReturn the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffemagicless- whether the buffer contains a magicless frame- Returns:
- the number of bytes of the original buffer 0 if the original size is not known
-
getDirectByteBufferFrameContentSize
public static long getDirectByteBufferFrameContentSize(java.nio.ByteBuffer src, int srcPosition, int srcSize, boolean magicless)Return the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffemagicless- whether the buffer contains a magicless frame- 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
-
decompressedDirectByteBufferSize
@Deprecated public static long decompressedDirectByteBufferSize(java.nio.ByteBuffer src, int srcPosition, int srcSize)Deprecated.Use `getDirectByteBufferFrameContentSize` that return also the errorsReturn the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffe- Returns:
- the number of bytes of the original buffer 0 if the original size is not known
-
getDirectByteBufferFrameContentSize
public static long getDirectByteBufferFrameContentSize(java.nio.ByteBuffer src, int srcPosition, int srcSize)Return the original size of a compressed buffer (if known)- Parameters:
src- the compressed buffersrcPosition- offset of the compressed data inside the src buffersrcSize- length of the compressed data inside the src buffe- 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
-
compressBound
public static long compressBound(long srcSize)
Maximum size of the compressed data- Parameters:
srcSize- the size of the data to be compressed- Returns:
- the maximum size of the compressed data
-
isError
public static boolean isError(long code)
Error handling- Parameters:
code- return code/size- Returns:
- if the return code signals an error
-
getErrorName
public static java.lang.String getErrorName(long code)
-
getErrorCode
public static long getErrorCode(long code)
-
errNoError
public static long errNoError()
-
errGeneric
public static long errGeneric()
-
errPrefixUnknown
public static long errPrefixUnknown()
-
errVersionUnsupported
public static long errVersionUnsupported()
-
errFrameParameterUnsupported
public static long errFrameParameterUnsupported()
-
errFrameParameterWindowTooLarge
public static long errFrameParameterWindowTooLarge()
-
errCorruptionDetected
public static long errCorruptionDetected()
-
errChecksumWrong
public static long errChecksumWrong()
-
errDictionaryCorrupted
public static long errDictionaryCorrupted()
-
errDictionaryWrong
public static long errDictionaryWrong()
-
errDictionaryCreationFailed
public static long errDictionaryCreationFailed()
-
errParameterUnsupported
public static long errParameterUnsupported()
-
errParameterOutOfBound
public static long errParameterOutOfBound()
-
errTableLogTooLarge
public static long errTableLogTooLarge()
-
errMaxSymbolValueTooLarge
public static long errMaxSymbolValueTooLarge()
-
errMaxSymbolValueTooSmall
public static long errMaxSymbolValueTooSmall()
-
errStageWrong
public static long errStageWrong()
-
errInitMissing
public static long errInitMissing()
-
errMemoryAllocation
public static long errMemoryAllocation()
-
errWorkSpaceTooSmall
public static long errWorkSpaceTooSmall()
-
errDstSizeTooSmall
public static long errDstSizeTooSmall()
-
errSrcSizeWrong
public static long errSrcSizeWrong()
-
errDstBufferNull
public static long errDstBufferNull()
-
trainFromBuffer
public static long trainFromBuffer(byte[][] samples, byte[] dictBuffer, boolean legacy)Creates a new dictionary to tune a kind of samples- Parameters:
samples- the samples buffer arraydictBuffer- the new dictionary bufferlegacy- use the legacy training algorithm; otherwise cover- Returns:
- the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
-
trainFromBufferDirect
public static long trainFromBufferDirect(java.nio.ByteBuffer samples, int[] sampleSizes, java.nio.ByteBuffer dictBuffer, boolean legacy)Creates a new dictionary to tune a kind of samples- Parameters:
samples- the samples direct byte buffer arraysampleSizes- java integer array of sizesdictBuffer- the new dictionary buffer (preallocated direct byte buffer)legacy- use the legacy training algorithm; oter- Returns:
- the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
-
getDictIdFromFrame
public static long getDictIdFromFrame(byte[] src)
Get DictId from a compressed frame- Parameters:
src- compressed frame- Returns:
- DictId or 0 if not available
-
getDictIdFromFrameBuffer
public static long getDictIdFromFrameBuffer(java.nio.ByteBuffer src)
Get DictId from a compressed ByteBuffer frame- Parameters:
src- compressed frame- Returns:
- DictId or 0 if not available
-
getDictIdFromDict
public static long getDictIdFromDict(byte[] dict)
Get DictId of a dictionary- Parameters:
dict- dictionary- Returns:
- DictId or 0 if not available
-
getDictIdFromDictDirect
public static long getDictIdFromDictDirect(java.nio.ByteBuffer dict)
Get DictId of a dictionary- Parameters:
dict- dictionary as Direct ByteBuffer- Returns:
- DictId or 0 if not available
-
trainFromBuffer
public static long trainFromBuffer(byte[][] samples, byte[] dictBuffer)Creates a new dictionary to tune a kind of samples (uses Cover algorithm)- Parameters:
samples- the samples buffer arraydictBuffer- the new dictionary buffer- Returns:
- the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
-
trainFromBufferDirect
public static long trainFromBufferDirect(java.nio.ByteBuffer samples, int[] sampleSizes, java.nio.ByteBuffer dictBuffer)Creates a new dictionary to tune a kind of samples (uses Cover algorithm)- Parameters:
samples- the samples direct byte buffer arraysampleSizes- java integer array of sizesdictBuffer- the new dictionary buffer (preallocated direct byte buffer)- Returns:
- the number of bytes into buffer 'dictBuffer' or an error code if it fails (which can be tested using ZSTD_isError())
-
magicNumber
public static int magicNumber()
-
windowLogMin
public static int windowLogMin()
-
windowLogMax
public static int windowLogMax()
-
chainLogMin
public static int chainLogMin()
-
chainLogMax
public static int chainLogMax()
-
hashLogMin
public static int hashLogMin()
-
hashLogMax
public static int hashLogMax()
-
searchLogMin
public static int searchLogMin()
-
searchLogMax
public static int searchLogMax()
-
searchLengthMin
public static int searchLengthMin()
-
searchLengthMax
public static int searchLengthMax()
-
blockSizeMax
public static int blockSizeMax()
-
defaultCompressionLevel
public static int defaultCompressionLevel()
-
minCompressionLevel
public static int minCompressionLevel()
-
maxCompressionLevel
public static int maxCompressionLevel()
-
compress
public static byte[] compress(byte[] src)
Compresses the data in buffer 'src' using default compression level- Parameters:
src- the source buffer- Returns:
- byte array with the compressed data
-
compress
public static byte[] compress(byte[] src, int level)Compresses the data in buffer 'src'- Parameters:
src- the source bufferlevel- compression level- Returns:
- byte array with the compressed data
-
compress
public static int compress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)Compresses the data in buffer 'srcBuf' using default compression level- Parameters:
dstBuf- 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.
srcBuf- 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().
- Returns:
- the size of the compressed data
-
compress
public static int compress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf, int level, boolean checksumFlag)Compresses the data in buffer 'srcBuf'- Parameters:
dstBuf- 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.
srcBuf- 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().
level- compression level- Returns:
- the size of the compressed data
-
compress
public static int compress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf, int level)
-
compress
public static java.nio.ByteBuffer compress(java.nio.ByteBuffer srcBuf, int level)Compresses the data in buffer 'srcBuf'- Parameters:
srcBuf- 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().
level- compression level- Returns:
- A newly allocated direct ByteBuffer containing the compressed data.
-
compress
public static byte[] compress(byte[] src, ZstdDictCompress dict)Compresses the data in buffer 'src'- Parameters:
src- the source bufferdict- dictionary to use- Returns:
- byte array with the compressed data
-
compressUsingDict
@Deprecated public static long compressUsingDict(byte[] dst, byte[] src, byte[] dict, int level)Deprecated.Use compress(dst, src, dict, level) insteadCompresses buffer 'src' into buffer 'dst' with dictionary.
-
compressUsingDict
public static byte[] compressUsingDict(byte[] src, byte[] dict, int level)Compresses buffer 'src' with dictionary.- Parameters:
src- the source bufferdict- the dictionary bufferlevel- compression level- Returns:
- compressed byte array
-
compress
public static long compress(byte[] dst, byte[] src, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dst- the destination buffersrc- the source bufferdict- the dictionary bufferlevel- compression level- Returns:
- the number of bytes written into buffer 'dst' or an error code if it fails (which can be tested using ZSTD_isError())
-
compress
public static int compress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dstBuff- the destination buffersrcBuff- the source bufferdict- the dictionary bufferlevel- compression level- Returns:
- the number of bytes written into buffer 'dstBuff'
-
compress
public static java.nio.ByteBuffer compress(java.nio.ByteBuffer srcBuff, byte[] dict, int level)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
srcBuff- the source bufferdict- the dictionary bufferlevel- compression level- Returns:
- compressed direct byte buffer
-
compress
public static int compress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
dstBuff- the destination buffersrcBuff- the source bufferdict- the dictionary buffer- Returns:
- the number of bytes written into buffer 'dstBuff'
-
compress
public static java.nio.ByteBuffer compress(java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)Compresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to handle worst cases situations (input data not compressible). Worst case size evaluation is provided by function ZSTD_compressBound().- Parameters:
srcBuff- the source bufferdict- the dictionary buffer- Returns:
- compressed direct byte buffer
-
decompress
public static byte[] decompress(byte[] src, int originalSize)Decompress data- Parameters:
src- the source bufferoriginalSize- 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.- Returns:
- byte array with the decompressed data
-
decompress
public static int decompress(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)Decompress data- Parameters:
dstBuf- 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.
srcBuf- 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().
- Returns:
- the size of the decompressed data.
-
decompress
public static java.nio.ByteBuffer decompress(java.nio.ByteBuffer srcBuf, int originalSize)Decompress data- Parameters:
srcBuf- 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().
originalSize- the maximum size of the uncompressed data- 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
public static byte[] decompress(byte[] src, ZstdDictDecompress dict, int originalSize)Decompress data- Parameters:
src- the source bufferdict- dictionary to useoriginalSize- the maximum size of the uncompressed data- Returns:
- byte array with the decompressed data
-
decompressUsingDict
@Deprecated public static long decompressUsingDict(byte[] dst, byte[] src, byte[] dict)Deprecated.Use decompress(dst, src, dict) insteadDecompresses buffer 'src' into buffer 'dst' with dictionary.
-
decompress
public static long decompress(byte[] dst, byte[] src, byte[] dict)Decompresses buffer 'src' into buffer 'dst' with dictionary. Destination buffer should be sized to be larger of equal to the originalSize- Parameters:
dst- the destination buffersrc- the source bufferdict- the dictionary buffer- Returns:
- the number of bytes decompressed into destination buffer (originalSize) or an errorCode if it fails (which can be tested using ZSTD_isError())
-
decompress
public static byte[] decompress(byte[] src, byte[] dict, int originalSize)- Parameters:
src- the source bufferdict- dictionary to useoriginalSize- the maximum size of the uncompressed data- Returns:
- byte array with the decompressed data
-
decompressedSize
@Deprecated public static long decompressedSize(java.nio.ByteBuffer srcBuf)
Deprecated.Use `getDirectByteBufferFrameContentSize` that return also the errorsReturn the original size of a compressed buffer (if known)- Parameters:
srcBuf- 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.- Returns:
- the number of bytes of the original buffer 0 if the original size is not known
-
getFrameContentSize
public static long getFrameContentSize(java.nio.ByteBuffer srcBuf)
Return the original size of a compressed buffer (if known)- Parameters:
srcBuf- 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.- 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
-
decompress
public static int decompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict)Decompress data- Parameters:
dstBuff- 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.
srcBuff- 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().
dict- the dictionary buffer to use for compression- Returns:
- the size of the decompressed data.
-
decompress
public static java.nio.ByteBuffer decompress(java.nio.ByteBuffer srcBuff, byte[] dict, int originalSize)Decompress data- Parameters:
srcBuff- 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().
dict- the dictionary used in the compressionoriginalSize- the maximum size of the uncompressed data- 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
public static int decompress(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict)Decompress data- Parameters:
dstBuff- 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.
srcBuff- 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().
dict- the dictionary buffer to use for compression- Returns:
- the size of the decompressed data.
-
decompress
public static java.nio.ByteBuffer decompress(java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict, int originalSize)Decompress data- Parameters:
srcBuff- 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().
dict- the dictionary used in the compressionoriginalSize- the maximum size of the uncompressed data- 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.
-
-