Class 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 int blockSizeMax()  
      static int chainLogMax()  
      static int chainLogMin()  
      static byte[] compress​(byte[] src)
      Compresses the data in buffer 'src' using default compression level
      static long compress​(byte[] dst, byte[] src, byte[] dict, int level)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      static long compress​(byte[] dst, byte[] src, int level)
      Compresses buffer 'src' into buffer 'dst'.
      static long compress​(byte[] dst, byte[] src, int level, boolean checksumFlag)
      Compresses buffer 'src' into buffer 'dst'.
      static long compress​(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.ByteBuffer compress​(java.nio.ByteBuffer srcBuff, byte[] dict, int level)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      static java.nio.ByteBuffer compress​(java.nio.ByteBuffer srcBuf, int level)
      Compresses the data in buffer 'srcBuf'
      static java.nio.ByteBuffer compress​(java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      static int compress​(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)
      Compresses the data in buffer 'srcBuf' using default compression level
      static int compress​(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict, int level)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      static int compress​(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf, int level)  
      static int compress​(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf, int level, boolean checksumFlag)
      Compresses the data in buffer 'srcBuf'
      static int compress​(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictCompress dict)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      static long compressBound​(long srcSize)
      Maximum size of the compressed data
      static long compressByteArray​(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize, int level)
      Compresses buffer 'src' into buffer 'dst'.
      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'.
      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'.
      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'.
      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.
      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.
      static long compressFastDict​(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictCompress dict)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      static long compressFastDict​(byte[] dst, int dstOffset, byte[] src, int srcOffset, ZstdDictCompress dict)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      static long compressUnsafe​(long dst, long dstSize, long src, long srcSize, int level)
      Compresses buffer 'src' into direct buffer 'dst'.
      static long compressUnsafe​(long dst, long dstSize, long src, long srcSize, int level, boolean checksumFlag)
      Compresses buffer 'src' into direct buffer 'dst'.
      static long compressUsingDict​(byte[] dst, byte[] src, byte[] dict, int level)
      Deprecated.
      Use compress(dst, src, dict, level) instead
      static byte[] compressUsingDict​(byte[] src, byte[] dict, int level)
      Compresses buffer 'src' with dictionary.
      static long compressUsingDict​(byte[] dst, int dstOffset, byte[] src, int srcOffset, byte[] dict, int level)
      Compresses buffer 'src' into buffer 'dst' with dictionary.
      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.
      static long decompress​(byte[] dst, byte[] src)
      Decompresses buffer 'src' into buffer 'dst'.
      static long decompress​(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 data
      static byte[] decompress​(byte[] src, ZstdDictDecompress dict, int originalSize)
      Decompress data
      static java.nio.ByteBuffer decompress​(java.nio.ByteBuffer srcBuff, byte[] dict, int originalSize)
      Decompress data
      static java.nio.ByteBuffer decompress​(java.nio.ByteBuffer srcBuf, int originalSize)
      Decompress data
      static java.nio.ByteBuffer decompress​(java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict, int originalSize)
      Decompress data
      static int decompress​(java.nio.ByteBuffer dstBuf, java.nio.ByteBuffer srcBuf)
      Decompress data
      static int decompress​(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, byte[] dict)
      Decompress data
      static int decompress​(java.nio.ByteBuffer dstBuff, java.nio.ByteBuffer srcBuff, ZstdDictDecompress dict)
      Decompress data
      static long decompressByteArray​(byte[] dst, int dstOffset, int dstSize, byte[] src, int srcOffset, int srcSize)
      Decompresses buffer 'src' into buffer 'dst'.
      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'.
      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.
      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.
      static long decompressedDirectByteBufferSize​(java.nio.ByteBuffer src, int srcPosition, int srcSize)
      Return the original size of a compressed buffer (if known)
      static long decompressedDirectByteBufferSize​(java.nio.ByteBuffer src, int srcPosition, int srcSize, boolean magicless)
      Return the original size of a compressed buffer (if known)
      static long decompressedSize​(byte[] src)
      Return the original size of a compressed buffer (if known)
      static long decompressedSize​(byte[] src, int srcPosition)
      Return the original size of a compressed buffer (if known)
      static long decompressedSize​(byte[] src, int srcPosition, int srcSize)
      Return the original size of a compressed buffer (if known)
      static long decompressedSize​(byte[] src, int srcPosition, int srcSize, boolean magicless)
      Return the original size of a compressed buffer (if known)
      static long decompressedSize​(java.nio.ByteBuffer srcBuf)
      Return the original size of a compressed buffer (if known)
      private static long decompressedSize0​(byte[] src, int srcPosition, int srcSize, boolean magicless)  
      static long decompressFastDict​(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, ZstdDictDecompress dict)
      Decompresses buffer 'src' into buffer 'dst' with dictionary.
      static long decompressUnsafe​(long dst, long dstSize, long src, long srcSize)
      Decompresses buffer 'src' into direct buffer 'dst'.
      static long decompressUsingDict​(byte[] dst, byte[] src, byte[] dict)
      Deprecated.
      Use decompress(dst, src, dict) instead
      static long decompressUsingDict​(byte[] dst, int dstOffset, byte[] src, int srcOffset, int length, byte[] dict)
      Decompresses buffer 'src' into buffer 'dst' with dictionary.
      static int defaultCompressionLevel()  
      static long errChecksumWrong()  
      static long errCorruptionDetected()  
      static long errDictionaryCorrupted()  
      static long errDictionaryCreationFailed()  
      static long errDictionaryWrong()  
      static long errDstBufferNull()  
      static long errDstSizeTooSmall()  
      static long errFrameParameterUnsupported()  
      static long errFrameParameterWindowTooLarge()  
      static long errGeneric()  
      static long errInitMissing()  
      static long errMaxSymbolValueTooLarge()  
      static long errMaxSymbolValueTooSmall()  
      static long errMemoryAllocation()  
      static long errNoError()  
      static long errParameterOutOfBound()  
      static long errParameterUnsupported()  
      static long errPrefixUnknown()  
      static long errSrcSizeWrong()  
      static long errStageWrong()  
      static long errTableLogTooLarge()  
      static long errVersionUnsupported()  
      static long errWorkSpaceTooSmall()  
      (package private) static byte[] extractArray​(java.nio.ByteBuffer buffer)  
      static long getDictIdFromDict​(byte[] dict)
      Get DictId of a dictionary
      static long getDictIdFromFrame​(byte[] src)
      Get DictId from a compressed frame
      static long getDictIdFromFrameBuffer​(java.nio.ByteBuffer src)
      Get DictId from a compressed ByteBuffer frame
      static long getErrorCode​(long code)  
      static java.lang.String getErrorName​(long code)  
      static int hashLogMax()  
      static int hashLogMin()  
      static boolean isError​(long code)
      Error handling
      static int loadDictCompress​(long stream, byte[] dict, int dict_size)  
      static int loadDictDecompress​(long stream, byte[] dict, int dict_size)  
      static int loadFastDictCompress​(long stream, ZstdDictCompress dict)  
      static int loadFastDictDecompress​(long stream, ZstdDictDecompress dict)  
      static int magicNumber()  
      static int maxCompressionLevel()  
      static int minCompressionLevel()  
      static int searchLengthMax()  
      static int searchLengthMin()  
      static int searchLogMax()  
      static int searchLogMin()  
      static int setCompressionChecksums​(long stream, boolean useChecksums)  
      static int setCompressionLevel​(long stream, int level)  
      static int setCompressionLong​(long stream, int windowLog)  
      static int setCompressionMagicless​(long stream, boolean useMagicless)  
      static int setCompressionWorkers​(long stream, int workers)  
      static int setDecompressionLongMax​(long stream, int windowLogMax)  
      static int setDecompressionMagicless​(long stream, boolean useMagicless)  
      static long trainFromBuffer​(byte[][] samples, byte[] dictBuffer)
      Creates a new dictionary to tune a kind of samples (uses Cover algorithm)
      static long trainFromBuffer​(byte[][] samples, byte[] dictBuffer, boolean legacy)
      Creates a new dictionary to tune a kind of samples
      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)
      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
      static int windowLogMax()  
      static int windowLogMin()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Zstd

        public Zstd()
    • 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 buffer
        src - the source buffer
        level - compression level
        checksumFlag - 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 buffer
        src - the source buffer
        level - 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 buffer
        dstOffset - offset from the start of the destination buffer
        dstSize - available space in the destination buffer after the offset
        src - the source buffer
        srcOffset - offset from the start of the source buffer
        srcSize - available data in the source buffer after the offset
        level - compression level
        checksumFlag - 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 buffer
        dstOffset - offset from the start of the destination buffer
        dstSize - available space in the destination buffer after the offset
        src - the source buffer
        srcOffset - offset from the start of the source buffer
        srcSize - available data in the source buffer after the offset
        level - 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 buffer
        dstOffset - offset from the start of the destination buffer
        dstSize - available space in the destination buffer after the offset
        src - the source buffer
        srcOffset - offset from the start of the source buffer
        srcSize - available data in the source buffer after the offset
        level - compression level
        checksumFlag - 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 buffer
        dstOffset - offset from the start of the destination buffer
        dstSize - available space in the destination buffer after the offset
        src - the source buffer
        srcOffset - offset from the start of the source buffer
        srcSize - available data in the source buffer after the offset
        level - 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 buffer
        dstSize - available space in the destination buffer
        src - pointer to the source buffer
        srcSize - available data in the source buffer
        level - compression level
        checksumFlag - 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 buffer
        dstSize - available space in the destination buffer
        src - pointer to the source buffer
        srcSize - available data in the source buffer
        level - 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 buffer
        dstOffset - the start offset of 'dst'
        src - the source buffer
        srcOffset - the start offset of 'src'
        length - the length of available data in 'src' after `srcOffset'
        dict - the dictionary buffer
        level - 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 buffer
        dstOffset - the start offset of 'dst'
        src - the source buffer
        srcOffset - the start offset of 'src'
        dict - the dictionary buffer
        level - 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 buffer
        dstOffset - the start offset of 'dst'
        dstSize - size of 'dst'
        src - the source buffer
        srcOffset - the start offset of 'src'
        srcSize - the length of 'src'
        dict - the dictionary buffer
        level - 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 buffer
        dstOffset - the start offset of 'dst'
        src - the source buffer
        srcOffset - 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 buffer
        dstOffset - the start offset of 'dst'
        src - the source buffer
        srcOffset - 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 buffer
        dstOffset - the start offset of 'dst'
        dstSize - the size of 'dst'
        src - the source buffer
        srcOffset - 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 buffer
        src - 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 buffer
        dstOffset - offset from the start of the destination buffer
        dstSize - available space in the destination buffer after the offset
        src - the source buffer
        srcOffset - offset from the start of the source buffer
        srcSize - 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 buffer
        dstOffset - offset from the start of the destination buffer
        dstSize - available space in the destination buffer after the offset
        src - the source buffer
        srcOffset - offset from the start of the source buffer
        srcSize - 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 buffer
        dstSize - available space in the destination buffer after the offset
        src - pointer the source buffer
        srcSize - 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 buffer
        dstOffset - the start offset of 'dst'
        src - the source buffer
        srcOffset - 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 buffer
        dstOffset - the start offset of 'dst'
        dstSize - size of 'dst'
        src - the source buffer
        srcOffset - 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 buffer
        dstOffset - the start offset of 'dst'
        src - the source buffer
        srcOffset - 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 buffer
        dstOffset - the start offset of 'dst'
        dstSize - the size of 'dst'
        src - the source buffer
        srcOffset - 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)
      • setDecompressionLongMax

        public static int setDecompressionLongMax​(long stream,
                                                  int windowLogMax)
      • setDecompressionMagicless

        public static int setDecompressionMagicless​(long stream,
                                                    boolean useMagicless)
      • decompressedSize

        public static long decompressedSize​(byte[] src,
                                            int srcPosition,
                                            int srcSize,
                                            boolean magicless)
        Return the original size of a compressed buffer (if known)
        Parameters:
        src - the compressed buffer
        srcPosition - offset of the compressed data inside the src buffer
        srcSize - length of the compressed data inside the src buffer
        magicless - whether the buffer contains a magicless frame
        Returns:
        the number of bytes of the original buffer 0 if the original size is not known
      • decompressedSize0

        private static long decompressedSize0​(byte[] src,
                                              int srcPosition,
                                              int srcSize,
                                              boolean magicless)
      • decompressedSize

        public static long decompressedSize​(byte[] src,
                                            int srcPosition,
                                            int srcSize)
        Return the original size of a compressed buffer (if known)
        Parameters:
        src - the compressed buffer
        srcPosition - offset of the compressed data inside the src buffer
        srcSize - 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
      • decompressedSize

        public static long decompressedSize​(byte[] src,
                                            int srcPosition)
        Return the original size of a compressed buffer (if known)
        Parameters:
        src - the compressed buffer
        srcPosition - 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
      • decompressedSize

        public static long decompressedSize​(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
      • decompressedDirectByteBufferSize

        public static long decompressedDirectByteBufferSize​(java.nio.ByteBuffer src,
                                                            int srcPosition,
                                                            int srcSize,
                                                            boolean magicless)
        Return the original size of a compressed buffer (if known)
        Parameters:
        src - the compressed buffer
        srcPosition - offset of the compressed data inside the src buffer
        srcSize - length of the compressed data inside the src buffe
        magicless - whether the buffer contains a magicless frame
        Returns:
        the number of bytes of the original buffer 0 if the original size is not known
      • decompressedDirectByteBufferSize

        public static long decompressedDirectByteBufferSize​(java.nio.ByteBuffer src,
                                                            int srcPosition,
                                                            int srcSize)
        Return the original size of a compressed buffer (if known)
        Parameters:
        src - the compressed buffer
        srcPosition - offset of the compressed data inside the src buffer
        srcSize - 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
      • 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 array
        dictBuffer - the new dictionary buffer
        legacy - 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 array
        sampleSizes - java integer array of sizes
        dictBuffer - 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
      • 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 array
        dictBuffer - 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 array
        sampleSizes - java integer array of sizes
        dictBuffer - 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 buffer
        level - 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 buffer
        dict - 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) instead
        Compresses 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 buffer
        dict - the dictionary buffer
        level - 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 buffer
        src - the source buffer
        dict - the dictionary buffer
        level - 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 buffer
        srcBuff - the source buffer
        dict - the dictionary buffer
        level - 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 buffer
        dict - the dictionary buffer
        level - 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 buffer
        srcBuff - the source buffer
        dict - 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 buffer
        dict - the dictionary buffer
        Returns:
        compressed direct byte buffer
      • decompress

        public static byte[] decompress​(byte[] src,
                                        int originalSize)
        Decompress data
        Parameters:
        src - the source buffer
        originalSize - 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 buffer
        dict - dictionary to use
        originalSize - 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) instead
        Decompresses 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 buffer
        src - the source buffer
        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())
      • decompress

        public static byte[] decompress​(byte[] src,
                                        byte[] dict,
                                        int originalSize)
        Parameters:
        src - the source buffer
        dict - dictionary to use
        originalSize - the maximum size of the uncompressed data
        Returns:
        byte array with the decompressed data
      • decompressedSize

        public static long decompressedSize​(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
      • 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 compression
        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 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 compression
        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.
      • extractArray

        static final byte[] extractArray​(java.nio.ByteBuffer buffer)