Class ZstdX


  • public class ZstdX
    extends java.lang.Object
    Native bindings to the experimental API of Zstandard (zstd).
    • Method Detail

      • nZSTD_findDecompressedSize

        public static long nZSTD_findDecompressedSize​(long src,
                                                      long srcSize)
        Unsafe version of: findDecompressedSize
        Parameters:
        srcSize - must be the exact size of this series (i.e. there should be a frame boundary exactly at srcSize bytes after src + srcSize)
      • ZSTD_findDecompressedSize

        public static long ZSTD_findDecompressedSize​(java.nio.ByteBuffer src)
        Note 1: decompressed size is an optional field, that may not be present, especially in streaming mode. When return==ZSTD_CONTENTSIZE_UNKNOWN, data to decompress could be any size. In which case, it's necessary to use streaming mode to decompress data.

        Note 2: decompressed size is always present when compression is done with compress.

        Note 3: decompressed size can be very large (64-bits value), potentially larger than what local system can handle as a single memory segment. In which case, it's necessary to use streaming mode to decompress data.

        Note 4: If source is untrusted, decompressed size could be wrong or intentionally modified. Always ensure result fits within application's authorized limits. Each application can set its own limits.

        Note 5: ZSTD_findDecompressedSize handles multiple frames, and so it must traverse the input to read each contained frame header. This is fast as most of the data is skipped, however it does mean that all frame data must be present and valid.

        Parameters:
        src - should point to the start of a series of ZSTD encoded and/or skippable frames
        Returns:
      • nZSTD_decompressBound

        public static long nZSTD_decompressBound​(long src,
                                                 long srcSize)
        Unsafe version of: decompressBound
        Parameters:
        srcSize - must be the exact size of this series (i.e. there should be a frame boundary at src + srcSize)
      • ZSTD_decompressBound

        public static long ZSTD_decompressBound​(java.nio.ByteBuffer src)
        Note 1: an error can occur if src contains an invalid or incorrectly formatted frame.

        Note 2: the upper-bound is exact when the decompressed size field is available in every ZSTD encoded frame of src. In this case, findDecompressedSize and ZSTD_decompressBound return the same value.

        Note 3: when the decompressed size field isn't available, the upper-bound for that frame is calculated by: upper-bound = # blocks * min(128 KB, Window_Size)

        Parameters:
        src - should point to the start of a series of ZSTD encoded and/or skippable frames
        Returns:
        upper-bound for the decompressed size of all data in all successive frames, or CONTENTSIZE_ERROR if an error occured
      • nZSTD_frameHeaderSize

        public static long nZSTD_frameHeaderSize​(long src,
                                                 long srcSize)
        Unsafe version of: frameHeaderSize
        Parameters:
        srcSize - must be ≥ FRAMEHEADERSIZE_PREFIX
      • ZSTD_frameHeaderSize

        public static long ZSTD_frameHeaderSize​(java.nio.ByteBuffer src)
        Returns:
        : size of the Frame Header, or an error code (if srcSize is too small)
      • ZSTD_estimateCCtxSize

        public static long ZSTD_estimateCCtxSize​(int compressionLevel)
        Estimages memory usage of a future CCtx, before its creation.

        ZSTD_estimateCCtxSize() will provide a budget large enough for any compression level up to selected one. It will also consider src size to be arbitrarily "large", which is worst case. If srcSize is known to always be small, estimateCCtxSize_usingCParams can provide a tighter estimation. estimateCCtxSize_usingCParams can be used in tandem with getCParams to create cParams from compressionLevel. estimateCCtxSize_usingCCtxParams can be used in tandem with CCtxParams_setParameter. Only single-threaded compression is supported.

        This function will return an error code if c_nbWorkers is ≥ 1.

        Note: CCtx size estimation is only correct for single-threaded compression.

      • nZSTD_estimateCCtxSize_usingCParams

        public static long nZSTD_estimateCCtxSize_usingCParams​(long cParams)
      • ZSTD_estimateCCtxSize_usingCParams

        public static long ZSTD_estimateCCtxSize_usingCParams​(ZSTDCompressionParameters cParams)
      • nZSTD_estimateCCtxSize_usingCCtxParams

        public static long nZSTD_estimateCCtxSize_usingCCtxParams​(long params)
      • ZSTD_estimateCCtxSize_usingCCtxParams

        public static long ZSTD_estimateCCtxSize_usingCCtxParams​(long params)
      • ZSTD_estimateDCtxSize

        public static long ZSTD_estimateDCtxSize()
      • ZSTD_estimateCStreamSize

        public static long ZSTD_estimateCStreamSize​(int compressionLevel)
        Provides a budget large enough for any compression level up to selected one.

        It will also consider src size to be arbitrarily "large", which is worst case. If srcSize is known to always be small, estimateCStreamSize_usingCParams can provide a tighter estimation. ZSTD_estimateCStreamSize_usingCParams() can be used in tandem with getCParams to create cParams from compressionLevel. estimateCStreamSize_usingCCtxParams can be used in tandem with CCtxParams_setParameter. Only single-threaded compression is supported.

        This function will return an error code if c_nbWorkers is ≥ 1.

        Note: CStream size estimation is only correct for single-threaded compression. ZSTD_DStream memory budget depends on window Size. This information can be passed manually, using estimateDStreamSize, or deducted from a valid frame Header, using estimateDStreamSize_fromFrame.

        Note: if streaming is init with function ZSTD_init?Stream_usingDict(), an internal Dict will be created, which additional size is not estimated here. In this case, get total size by adding ZSTD_estimate?DictSize.

      • nZSTD_estimateCStreamSize_usingCParams

        public static long nZSTD_estimateCStreamSize_usingCParams​(long cParams)
      • ZSTD_estimateCStreamSize_usingCParams

        public static long ZSTD_estimateCStreamSize_usingCParams​(ZSTDCompressionParameters cParams)
      • nZSTD_estimateCStreamSize_usingCCtxParams

        public static long nZSTD_estimateCStreamSize_usingCCtxParams​(long params)
      • ZSTD_estimateCStreamSize_usingCCtxParams

        public static long ZSTD_estimateCStreamSize_usingCCtxParams​(long params)
      • ZSTD_estimateDStreamSize

        public static long ZSTD_estimateDStreamSize​(long windowSize)
      • nZSTD_estimateDStreamSize_fromFrame

        public static long nZSTD_estimateDStreamSize_fromFrame​(long src,
                                                               long srcSize)
      • ZSTD_estimateDStreamSize_fromFrame

        public static long ZSTD_estimateDStreamSize_fromFrame​(java.nio.ByteBuffer src)
      • ZSTD_estimateCDictSize

        public static long ZSTD_estimateCDictSize​(long dictSize,
                                                  int compressionLevel)
      • nZSTD_estimateCDictSize_advanced

        public static long nZSTD_estimateCDictSize_advanced​(long dictSize,
                                                            long cParams,
                                                            int dictLoadMethod)
        Unsafe version of: estimateCDictSize_advanced
      • ZSTD_estimateCDictSize_advanced, ZSTD_estimateDDictSize

        public static long ZSTD_estimateCDictSize_advanced​(long dictSize,
                                                           ZSTDCompressionParameters cParams,
                                                           int dictLoadMethod)
        
        public static long ZSTD_estimateDDictSize​(long dictSize,
                                                  int dictLoadMethod)
        
        Parameters:
        dictLoadMethod - one of:
        dlm_byCopydlm_byRef
      • nZSTD_initStaticCCtx

        public static long nZSTD_initStaticCCtx​(long workspace,
                                                long workspaceSize)
      • ZSTD_initStaticCCtx

        public static long ZSTD_initStaticCCtx​(java.nio.ByteBuffer workspace)
      • nZSTD_initStaticCStream

        public static long nZSTD_initStaticCStream​(long workspace,
                                                   long workspaceSize)
      • ZSTD_initStaticCStream

        public static long ZSTD_initStaticCStream​(java.nio.ByteBuffer workspace)
      • nZSTD_initStaticDCtx

        public static long nZSTD_initStaticDCtx​(long workspace,
                                                long workspaceSize)
      • ZSTD_initStaticDCtx

        public static long ZSTD_initStaticDCtx​(java.nio.ByteBuffer workspace)
      • nZSTD_initStaticDStream

        public static long nZSTD_initStaticDStream​(long workspace,
                                                   long workspaceSize)
      • ZSTD_initStaticDStream

        public static long ZSTD_initStaticDStream​(java.nio.ByteBuffer workspace)
      • nZSTD_initStaticCDict

        public static long nZSTD_initStaticCDict​(long workspace,
                                                 long workspaceSize,
                                                 long dict,
                                                 long dictSize,
                                                 int dictLoadMethod,
                                                 int dictContentType,
                                                 long cParams)
        Unsafe version of: initStaticCDict
      • nZSTD_initStaticDDict

        public static long nZSTD_initStaticDDict​(long workspace,
                                                 long workspaceSize,
                                                 long dict,
                                                 long dictSize,
                                                 int dictLoadMethod,
                                                 int dictContentType)
        Unsafe version of: initStaticDDict
      • ZSTD_initStaticDDict

        public static long ZSTD_initStaticDDict​(java.nio.ByteBuffer workspace,
                                                java.nio.ByteBuffer dict,
                                                int dictLoadMethod,
                                                int dictContentType)
        Parameters:
        dictLoadMethod - one of:
        dlm_byCopydlm_byRef
        dictContentType - one of:
        dct_autodct_rawContentdct_fullDict
      • nZSTD_createCCtx_advanced

        public static long nZSTD_createCCtx_advanced​(long customMem)
      • ZSTD_createCCtx_advanced

        public static long ZSTD_createCCtx_advanced​(ZSTDCustomMem customMem)
      • nZSTD_createCStream_advanced

        public static long nZSTD_createCStream_advanced​(long customMem)
      • ZSTD_createCStream_advanced

        public static long ZSTD_createCStream_advanced​(ZSTDCustomMem customMem)
      • nZSTD_createDCtx_advanced

        public static long nZSTD_createDCtx_advanced​(long customMem)
      • ZSTD_createDCtx_advanced

        public static long ZSTD_createDCtx_advanced​(ZSTDCustomMem customMem)
      • nZSTD_createDStream_advanced

        public static long nZSTD_createDStream_advanced​(long customMem)
      • ZSTD_createDStream_advanced

        public static long ZSTD_createDStream_advanced​(ZSTDCustomMem customMem)
      • nZSTD_createCDict_advanced

        public static long nZSTD_createCDict_advanced​(long dict,
                                                      long dictSize,
                                                      int dictLoadMethod,
                                                      int dictContentType,
                                                      long cParams,
                                                      long customMem)
        Unsafe version of: createCDict_advanced
      • nZSTD_createDDict_advanced

        public static long nZSTD_createDDict_advanced​(long dict,
                                                      long dictSize,
                                                      int dictLoadMethod,
                                                      int dictContentType,
                                                      long customMem)
        Unsafe version of: createDDict_advanced
      • nZSTD_createCDict_byReference

        public static long nZSTD_createCDict_byReference​(long dictBuffer,
                                                         long dictSize,
                                                         int compressionLevel)
        Unsafe version of: createCDict_byReference
      • ZSTD_createCDict_byReference

        public static long ZSTD_createCDict_byReference​(java.nio.ByteBuffer dictBuffer,
                                                        int compressionLevel)
        Creates a digested dictionary for compression Dictionary content is just referenced, not duplicated.

        As a consequence, dictBuffer must outlive CDict, and its content must remain unmodified throughout the lifetime of CDict.

      • nZSTD_getCParams

        public static void nZSTD_getCParams​(int compressionLevel,
                                            long estimatedSrcSize,
                                            long dictSize,
                                            long __result)
        Unsafe version of: getCParams
      • ZSTD_getCParams

        public static ZSTDCompressionParameters ZSTD_getCParams​(int compressionLevel,
                                                                long estimatedSrcSize,
                                                                long dictSize,
                                                                ZSTDCompressionParameters __result)
        Returns ZSTD_compressionParameters structure for a selected compression level and estimated srcSize.
        Parameters:
        estimatedSrcSize - optional, select 0 if not known
      • nZSTD_getParams

        public static void nZSTD_getParams​(int compressionLevel,
                                           long estimatedSrcSize,
                                           long dictSize,
                                           long __result)
        Unsafe version of: getParams
      • ZSTD_getParams

        public static ZSTDParameters ZSTD_getParams​(int compressionLevel,
                                                    long estimatedSrcSize,
                                                    long dictSize,
                                                    ZSTDParameters __result)
        Same as getCParams(), but returns a full ZSTD_parameters object instead of sub-component ZSTD_compressionParameters.

        All fields of ZSTD_frameParameters are set to default: contentSize=1, checksum=0, noDictID=0.

        Parameters:
        estimatedSrcSize - optional, select 0 if not known
      • nZSTD_checkCParams

        public static long nZSTD_checkCParams​(long params)
        Unsafe version of: checkCParams
      • ZSTD_checkCParams

        public static long ZSTD_checkCParams​(ZSTDCompressionParameters params)
        Ensures param values remain within authorized range.
        Returns:
        0 on success, or an error code (can be checked with isError)
      • nZSTD_adjustCParams

        public static void nZSTD_adjustCParams​(long cPar,
                                               long srcSize,
                                               long dictSize,
                                               long __result)
        Unsafe version of: adjustCParams
      • nZSTD_compress_advanced

        public static long nZSTD_compress_advanced​(long cctx,
                                                   long dst,
                                                   long dstCapacity,
                                                   long src,
                                                   long srcSize,
                                                   long dict,
                                                   long dictSize,
                                                   long params)
        Unsafe version of: compress_advanced
      • ZSTD_compress_advanced

        public static long ZSTD_compress_advanced​(long cctx,
                                                  java.nio.ByteBuffer dst,
                                                  java.nio.ByteBuffer src,
                                                  java.nio.ByteBuffer dict,
                                                  ZSTDParameters params)
        Same as compress_usingDict, with fine-tune control over compression parameters (by structure).
      • nZSTD_compress_usingCDict_advanced

        public static long nZSTD_compress_usingCDict_advanced​(long cctx,
                                                              long dst,
                                                              long dstCapacity,
                                                              long src,
                                                              long srcSize,
                                                              long cdict,
                                                              long fParams)
        Unsafe version of: compress_usingCDict_advanced
      • ZSTD_compress_usingCDict_advanced

        public static long ZSTD_compress_usingCDict_advanced​(long cctx,
                                                             java.nio.ByteBuffer dst,
                                                             java.nio.ByteBuffer src,
                                                             long cdict,
                                                             ZSTDFrameParameters fParams)
        Same as compress_usingCDict, with fine-tune control over frame parameters.
      • nZSTD_CCtx_loadDictionary_byReference

        public static long nZSTD_CCtx_loadDictionary_byReference​(long cctx,
                                                                 long dict,
                                                                 long dictSize)
      • ZSTD_CCtx_loadDictionary_byReference

        public static long ZSTD_CCtx_loadDictionary_byReference​(long cctx,
                                                                java.nio.ByteBuffer dict)
        Same as CCtx_loadDictionary, but dictionary content is referenced, instead of being copied into CCtx.

        It saves some memory, but also requires that dict outlives its usage within cctx.

      • nZSTD_CCtx_loadDictionary_advanced

        public static long nZSTD_CCtx_loadDictionary_advanced​(long cctx,
                                                              long dict,
                                                              long dictSize,
                                                              int dictLoadMethod,
                                                              int dictContentType)
        Unsafe version of: CCtx_loadDictionary_advanced
      • ZSTD_CCtx_loadDictionary_advanced

        public static long ZSTD_CCtx_loadDictionary_advanced​(long cctx,
                                                             java.nio.ByteBuffer dict,
                                                             int dictLoadMethod,
                                                             int dictContentType)
        Same as CCtx_loadDictionary, but gives finer control over how to load the dictionary (by copy ? by reference ?) and how to interpret it (automatic ? force raw mode ? full mode only ?).
        Parameters:
        dictLoadMethod - one of:
        dlm_byCopydlm_byRef
        dictContentType - one of:
        dct_autodct_rawContentdct_fullDict
      • nZSTD_CCtx_refPrefix_advanced

        public static long nZSTD_CCtx_refPrefix_advanced​(long cctx,
                                                         long prefix,
                                                         long prefixSize,
                                                         int dictContentType)
        Unsafe version of: CCtx_refPrefix_advanced
      • ZSTD_CCtx_refPrefix_advanced

        public static long ZSTD_CCtx_refPrefix_advanced​(long cctx,
                                                        java.nio.ByteBuffer prefix,
                                                        int dictContentType)
        Same as CCtx_refPrefix, but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?).
        Parameters:
        dictContentType - one of:
        dct_autodct_rawContentdct_fullDict
      • nZSTD_CCtx_getParameter

        public static long nZSTD_CCtx_getParameter​(long cctx,
                                                   int param,
                                                   long value)
        Unsafe version of: CCtx_getParameter
      • ZSTD_createCCtxParams

        public static long ZSTD_createCCtxParams()
        Creates a ZSTD_CCtx_params structure.
      • nZSTD_freeCCtxParams

        public static long nZSTD_freeCCtxParams​(long params)
      • ZSTD_freeCCtxParams

        public static long ZSTD_freeCCtxParams​(long params)
      • nZSTD_CCtxParams_reset

        public static long nZSTD_CCtxParams_reset​(long params)
        Unsafe version of: CCtxParams_reset
      • ZSTD_CCtxParams_reset

        public static long ZSTD_CCtxParams_reset​(long params)
        Resets params to default values.
      • nZSTD_CCtxParams_init

        public static long nZSTD_CCtxParams_init​(long cctxParams,
                                                 int compressionLevel)
        Unsafe version of: CCtxParams_init
      • ZSTD_CCtxParams_init

        public static long ZSTD_CCtxParams_init​(long cctxParams,
                                                int compressionLevel)
        Initializes the compression parameters of cctxParams according to compression level. All other parameters are reset to their default values.
      • nZSTD_CCtxParams_init_advanced

        public static long nZSTD_CCtxParams_init_advanced​(long cctxParams,
                                                          long params)
        Unsafe version of: CCtxParams_init_advanced
      • ZSTD_CCtxParams_init_advanced

        public static long ZSTD_CCtxParams_init_advanced​(long cctxParams,
                                                         ZSTDParameters params)
        Initializes the compression and frame parameters of cctxParams according to params. All other parameters are reset to their default values.
      • nZSTD_CCtxParams_setParameter

        public static long nZSTD_CCtxParams_setParameter​(long params,
                                                         int param,
                                                         int value)
        Unsafe version of: CCtxParams_setParameter
      • nZSTD_CCtxParams_getParameter

        public static long nZSTD_CCtxParams_getParameter​(long params,
                                                         int param,
                                                         long value)
        Unsafe version of: CCtxParams_getParameter
      • nZSTD_CCtx_setParametersUsingCCtxParams

        public static long nZSTD_CCtx_setParametersUsingCCtxParams​(long cctx,
                                                                   long params)
      • ZSTD_CCtx_setParametersUsingCCtxParams

        public static long ZSTD_CCtx_setParametersUsingCCtxParams​(long cctx,
                                                                  long params)
        Applies a set of ZSTD_CCtx_params to the compression context.

        This can be done even after compression is started, if nbWorkers==0, this will have no impact until a new compression is started. If nbWorkers ≥ 1, new parameters will be picked up at next job, with a few restrictions (windowLog, pledgedSrcSize, nbWorkers, jobSize, and overlapLog are not updated).

      • nZSTD_compressStream2_simpleArgs

        public static long nZSTD_compressStream2_simpleArgs​(long cctx,
                                                            long dst,
                                                            long dstCapacity,
                                                            long dstPos,
                                                            long src,
                                                            long srcSize,
                                                            long srcPos,
                                                            int endOp)
        Unsafe version of: compressStream2_simpleArgs
      • ZSTD_compressStream2_simpleArgs

        public static long ZSTD_compressStream2_simpleArgs​(long cctx,
                                                           java.nio.ByteBuffer dst,
                                                           PointerBuffer dstPos,
                                                           java.nio.ByteBuffer src,
                                                           PointerBuffer srcPos,
                                                           int endOp)
        Same as compressStream2, but using only integral types as arguments.

        This variant might be helpful for binders from dynamic languages which have troubles handling structures containing memory pointers.

        Parameters:
        endOp - one of:
        e_continuee_flushe_end
      • nZSTD_isFrame

        public static int nZSTD_isFrame​(long buffer,
                                        long size)
        Unsafe version of: isFrame
      • ZSTD_isFrame

        public static boolean ZSTD_isFrame​(java.nio.ByteBuffer buffer)
        Tells if the content of buffer starts with a valid Frame Identifier.

        Notes:

        1. Frame Identifier is 4 bytes. If size < 4, @return will always be 0.
        2. Legacy Frame Identifiers are considered valid only if Legacy Support is enabled.
        3. Skippable Frame Identifiers are considered valid.
      • nZSTD_createDDict_byReference

        public static long nZSTD_createDDict_byReference​(long dictBuffer,
                                                         long dictSize)
        Unsafe version of: createDDict_byReference
      • ZSTD_createDDict_byReference

        public static long ZSTD_createDDict_byReference​(java.nio.ByteBuffer dictBuffer)
        Creates a digested dictionary, ready to start decompression operation without startup delay.

        Dictionary content is referenced, and therefore stays in dictBuffer. It is important that dictBuffer outlives DDict, it must remain read accessible throughout the lifetime of DDict.

      • nZSTD_DCtx_loadDictionary_byReference

        public static long nZSTD_DCtx_loadDictionary_byReference​(long dctx,
                                                                 long dict,
                                                                 long dictSize)
      • ZSTD_DCtx_loadDictionary_byReference

        public static long ZSTD_DCtx_loadDictionary_byReference​(long dctx,
                                                                java.nio.ByteBuffer dict)
        Same as DCtx_loadDictionary, but references dict content instead of copying it into dctx.

        This saves memory if dict remains around. However, it's imperative that dict remains accessible (and unmodified) while being used, so it must outlive decompression.

      • nZSTD_DCtx_loadDictionary_advanced

        public static long nZSTD_DCtx_loadDictionary_advanced​(long dctx,
                                                              long dict,
                                                              long dictSize,
                                                              int dictLoadMethod,
                                                              int dictContentType)
        Unsafe version of: DCtx_loadDictionary_advanced
      • ZSTD_DCtx_loadDictionary_advanced

        public static long ZSTD_DCtx_loadDictionary_advanced​(long dctx,
                                                             java.nio.ByteBuffer dict,
                                                             int dictLoadMethod,
                                                             int dictContentType)
        Same as DCtx_loadDictionary, but gives direct control over how to load the dictionary (by copy ? by reference ?) and how to interpret it (automatic ? force raw mode ? full mode only ?).
        Parameters:
        dictLoadMethod - one of:
        dlm_byCopydlm_byRef
        dictContentType - one of:
        dct_autodct_rawContentdct_fullDict
      • nZSTD_DCtx_refPrefix_advanced

        public static long nZSTD_DCtx_refPrefix_advanced​(long dctx,
                                                         long prefix,
                                                         long prefixSize,
                                                         int dictContentType)
        Unsafe version of: DCtx_refPrefix_advanced
      • ZSTD_DCtx_refPrefix_advanced

        public static long ZSTD_DCtx_refPrefix_advanced​(long dctx,
                                                        java.nio.ByteBuffer prefix,
                                                        int dictContentType)
        Same as DCtx_refPrefix, but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?).
        Parameters:
        dictContentType - one of:
        dct_autodct_rawContentdct_fullDict
      • nZSTD_DCtx_setMaxWindowSize

        public static long nZSTD_DCtx_setMaxWindowSize​(long dctx,
                                                       long maxWindowSize)
        Unsafe version of: DCtx_setMaxWindowSize
      • ZSTD_DCtx_setMaxWindowSize

        public static long ZSTD_DCtx_setMaxWindowSize​(long dctx,
                                                      long maxWindowSize)
        Refuses allocating internal buffers for frames requiring a window size larger than provided limit.

        This protects a decoder context from reserving too much memory for itself (potential attack scenario). This parameter is only useful in streaming mode, since no internal buffer is allocated in single-pass mode. By default, a decompression context accepts all window sizes ≤ (1 << WINDOWLOG_LIMIT_DEFAULT).

        Returns:
        0, or an error code (which can be tested using isError)
      • nZSTD_DCtx_setFormat

        public static long nZSTD_DCtx_setFormat​(long dctx,
                                                int format)
        Unsafe version of: DCtx_setFormat
      • ZSTD_DCtx_setFormat

        public static long ZSTD_DCtx_setFormat​(long dctx,
                                               int format)
        Instructs the decoder context about what kind of data to decode next.

        This instruction is mandatory to decode data without a fully-formed header, such f_zstd1_magicless for example.

        Parameters:
        format - one of:
        f_zstd1f_zstd1_magicless
        Returns:
        0, or an error code (which can be tested using isError)
      • nZSTD_decompressStream_simpleArgs

        public static long nZSTD_decompressStream_simpleArgs​(long dctx,
                                                             long dst,
                                                             long dstCapacity,
                                                             long dstPos,
                                                             long src,
                                                             long srcSize,
                                                             long srcPos)
        Unsafe version of: decompressStream_simpleArgs
      • ZSTD_decompressStream_simpleArgs

        public static long ZSTD_decompressStream_simpleArgs​(long dctx,
                                                            java.nio.ByteBuffer dst,
                                                            PointerBuffer dstPos,
                                                            java.nio.ByteBuffer src,
                                                            PointerBuffer srcPos)
        Same as decompressStream, but using only integral types as arguments.

        This can be helpful for binders from dynamic languages which have troubles handling structures containing memory pointers.

      • nZSTD_getFrameProgression

        public static void nZSTD_getFrameProgression​(long cctx,
                                                     long __result)
        Unsafe version of: getFrameProgression
      • ZSTD_getFrameProgression

        public static ZSTDFrameProgression ZSTD_getFrameProgression​(long cctx,
                                                                    ZSTDFrameProgression __result)
        Tells how much data has been ingested (read from input) consumed (input actually compressed) and produced (output) for current frame.

        Note: (ingested - consumed) is amount of input data buffered internally, not yet compressed. Aggregates progression inside active worker threads.

      • nZSTD_toFlushNow

        public static long nZSTD_toFlushNow​(long cctx)
        Unsafe version of: toFlushNow
      • ZSTD_toFlushNow

        public static long ZSTD_toFlushNow​(long cctx)
        Tells how many bytes are ready to be flushed immediately.

        Useful for multithreading scenarios (nbWorkers ≥ 1). Probe the oldest active job, defined as oldest job not yet entirely flushed, and check its output buffer.

        Returns:
        amount of data stored in oldest job and ready to be flushed immediately. If == 0, it means either:
        • there is no active job (could be checked with getFrameProgression), or
        • oldest job is still actively compressing data, but everything it has produced has also been flushed so far, therefore flush speed is limited by production speed of oldest job irrespective of the speed of concurrent (and newer) jobs.
      • nZSTD_compressBegin

        public static long nZSTD_compressBegin​(long cctx,
                                               int compressionLevel)
      • ZSTD_compressBegin

        public static long ZSTD_compressBegin​(long cctx,
                                              int compressionLevel)
      • nZSTD_compressBegin_usingDict

        public static long nZSTD_compressBegin_usingDict​(long cctx,
                                                         long dict,
                                                         long dictSize,
                                                         int compressionLevel)
      • ZSTD_compressBegin_usingDict

        public static long ZSTD_compressBegin_usingDict​(long cctx,
                                                        java.nio.ByteBuffer dict,
                                                        int compressionLevel)
      • nZSTD_compressBegin_advanced

        public static long nZSTD_compressBegin_advanced​(long cctx,
                                                        long dict,
                                                        long dictSize,
                                                        long params,
                                                        long pledgedSrcSize)
      • ZSTD_compressBegin_advanced

        public static long ZSTD_compressBegin_advanced​(long cctx,
                                                       java.nio.ByteBuffer dict,
                                                       ZSTDParameters params,
                                                       long pledgedSrcSize)
      • nZSTD_compressBegin_usingCDict

        public static long nZSTD_compressBegin_usingCDict​(long cctx,
                                                          long cdict)
      • ZSTD_compressBegin_usingCDict

        public static long ZSTD_compressBegin_usingCDict​(long cctx,
                                                         long cdict)
      • nZSTD_compressBegin_usingCDict_advanced

        public static long nZSTD_compressBegin_usingCDict_advanced​(long cctx,
                                                                   long cdict,
                                                                   long fParams,
                                                                   long pledgedSrcSize)
      • ZSTD_compressBegin_usingCDict_advanced

        public static long ZSTD_compressBegin_usingCDict_advanced​(long cctx,
                                                                  long cdict,
                                                                  ZSTDFrameParameters fParams,
                                                                  long pledgedSrcSize)
        Parameters:
        pledgedSrcSize - if not known, use CONTENTSIZE_UNKNOWN
      • nZSTD_copyCCtx

        public static long nZSTD_copyCCtx​(long cctx,
                                          long preparedCCtx,
                                          long pledgedSrcSize)
        Unsafe version of: copyCCtx
      • ZSTD_copyCCtx

        public static long ZSTD_copyCCtx​(long cctx,
                                         long preparedCCtx,
                                         long pledgedSrcSize)
        Parameters:
        pledgedSrcSize - if not known, use CONTENTSIZE_UNKNOWN
      • nZSTD_compressContinue

        public static long nZSTD_compressContinue​(long cctx,
                                                  long dst,
                                                  long dstCapacity,
                                                  long src,
                                                  long srcSize)
      • ZSTD_compressContinue

        public static long ZSTD_compressContinue​(long cctx,
                                                 java.nio.ByteBuffer dst,
                                                 java.nio.ByteBuffer src)
      • nZSTD_compressEnd

        public static long nZSTD_compressEnd​(long cctx,
                                             long dst,
                                             long dstCapacity,
                                             long src,
                                             long srcSize)
      • ZSTD_compressEnd

        public static long ZSTD_compressEnd​(long cctx,
                                            java.nio.ByteBuffer dst,
                                            java.nio.ByteBuffer src)
      • nZSTD_getFrameHeader

        public static long nZSTD_getFrameHeader​(long zfhPtr,
                                                long src,
                                                long srcSize)
        Unsafe version of: getFrameHeader
      • ZSTD_getFrameHeader

        public static long ZSTD_getFrameHeader​(ZSTDFrameHeader zfhPtr,
                                               java.nio.ByteBuffer src)
        Decode Frame Header, or requires larger srcSize.
        Returns:
        0, zfhPtr is correctly filled, >0, srcSize is too small, value is wanted srcSize amount, or an error code, which can be tested using isError
      • nZSTD_getFrameHeader_advanced

        public static long nZSTD_getFrameHeader_advanced​(long zfhPtr,
                                                         long src,
                                                         long srcSize,
                                                         int format)
        Unsafe version of: getFrameHeader_advanced
      • ZSTD_decodingBufferSize_min

        public static long ZSTD_decodingBufferSize_min​(long windowSize,
                                                       long frameContentSize)
      • nZSTD_decompressBegin

        public static long nZSTD_decompressBegin​(long dctx)
      • ZSTD_decompressBegin

        public static long ZSTD_decompressBegin​(long dctx)
      • nZSTD_decompressBegin_usingDict

        public static long nZSTD_decompressBegin_usingDict​(long dctx,
                                                           long dict,
                                                           long dictSize)
      • ZSTD_decompressBegin_usingDict

        public static long ZSTD_decompressBegin_usingDict​(long dctx,
                                                          java.nio.ByteBuffer dict)
      • nZSTD_decompressBegin_usingDDict

        public static long nZSTD_decompressBegin_usingDDict​(long dctx,
                                                            long ddict)
      • ZSTD_decompressBegin_usingDDict

        public static long ZSTD_decompressBegin_usingDDict​(long dctx,
                                                           long ddict)
      • nZSTD_nextSrcSizeToDecompress

        public static long nZSTD_nextSrcSizeToDecompress​(long dctx)
      • ZSTD_nextSrcSizeToDecompress

        public static long ZSTD_nextSrcSizeToDecompress​(long dctx)
      • nZSTD_decompressContinue

        public static long nZSTD_decompressContinue​(long dctx,
                                                    long dst,
                                                    long dstCapacity,
                                                    long src,
                                                    long srcSize)
      • ZSTD_decompressContinue

        public static long ZSTD_decompressContinue​(long dctx,
                                                   java.nio.ByteBuffer dst,
                                                   java.nio.ByteBuffer src)
      • nZSTD_copyDCtx

        public static void nZSTD_copyDCtx​(long dctx,
                                          long preparedDCtx)
      • ZSTD_copyDCtx

        public static void ZSTD_copyDCtx​(long dctx,
                                         long preparedDCtx)
      • nZSTD_nextInputType

        public static int nZSTD_nextInputType​(long dctx)
      • ZSTD_nextInputType

        public static int ZSTD_nextInputType​(long dctx)
      • nZSTD_getBlockSize

        public static long nZSTD_getBlockSize​(long cctx)
      • ZSTD_getBlockSize

        public static long ZSTD_getBlockSize​(long cctx)
      • nZSTD_compressBlock

        public static long nZSTD_compressBlock​(long cctx,
                                               long dst,
                                               long dstCapacity,
                                               long src,
                                               long srcSize)
      • ZSTD_compressBlock

        public static long ZSTD_compressBlock​(long cctx,
                                              java.nio.ByteBuffer dst,
                                              java.nio.ByteBuffer src)
      • nZSTD_decompressBlock

        public static long nZSTD_decompressBlock​(long dctx,
                                                 long dst,
                                                 long dstCapacity,
                                                 long src,
                                                 long srcSize)
      • ZSTD_decompressBlock

        public static long ZSTD_decompressBlock​(long dctx,
                                                java.nio.ByteBuffer dst,
                                                java.nio.ByteBuffer src)
      • nZSTD_insertBlock

        public static long nZSTD_insertBlock​(long dctx,
                                             long blockStart,
                                             long blockSize)
        Unsafe version of: insertBlock
      • ZSTD_insertBlock

        public static long ZSTD_insertBlock​(long dctx,
                                            java.nio.ByteBuffer blockStart)
        Insert uncompressed block into dctx history. Useful for multi-blocks decompression.