Class ZstdX
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The minimum valid max blocksize.static final int
Default is0 == ZSTD_sf_noBlockDelimiters
.static final int
Default is0 == disabled
.static final int
Controls whether the new and experimental "dedicated dictionary search structure" can be used.static final int
Allowed values are 0 (disable) and 1 (enable).static final int
Controls whether the contents of aCDict
are used in place, or copied into the working context.static final int
Force back-reference distances to remain <windowSize
, even when referencing into Dictionary content.static final int
Select a compression format.static final int
Controlled withZSTD_paramSwitch_e
enum.static final int
Allowed values are between 1KB andBLOCKSIZE_MAX
(128KB).static final int
Controlled with ZSTD_paramSwitch_e enum.static final int
Enablesrsyncable mode, which makes compressed files more rsync friendly by adding periodic synchronization points to the compressed data.
The target average block size isc_jobSize
/ 2.static final int
This parameter affects how zstd parses external sequences, such as sequences provided through thecompressSequences
API or from an external block-level sequence producer.static final int
User's best guess of source size.static final int
Experimental parameter.static final int
Experimental parameter.static final int
Tries to fit compressed block size to be aroundtargetCBlockSize
.static final int
Controlled withZSTD_paramSwitch_e
enum.static final int
Controlled withZSTD_paramSwitch_e
enum.static final int
Default is0 == disabled
.static final int
static final int
static final int
static final int
static final int
Set to 1 to disable the Huffman assembly implementation.static final int
Experimental parameter.static final int
Experimental parameter.static final int
This enum controlsd_forceIgnoreChecksum
.static final int
Experimental parameter.static final int
Experimental parameter.static final int
This enum controlsd_forceIgnoreChecksum
.static final int
ZSTD_dictContentType_e
static final int
ZSTD_dictContentType_e
static final int
ZSTD_dictContentType_e
static final int
ZSTD_dictAttachPref_e
static final int
ZSTD_dictAttachPref_e
static final int
ZSTD_dictAttachPref_e
static final int
ZSTD_dictAttachPref_e
static final int
ZSTD_dictLoadMethod_e
static final int
ZSTD_dictLoadMethod_e
static final int
ZSTD_format_e
static final int
ZSTD_format_e
static final int
ZSTD_frameType_e
static final int
static final int
static final int
static final int
ZSTD_literalCompressionMode_e
static final int
ZSTD_literalCompressionMode_e
static final int
ZSTD_literalCompressionMode_e
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
ZSTD_paramSwitch_e
static final int
ZSTD_paramSwitch_e
static final int
ZSTD_paramSwitch_e
static final int
This enum controlsd_refMultipleDDicts
.static final int
This enum controlsd_refMultipleDDicts
.static final int
static final long
static final int
ZSTD_sequenceFormat_e
static final int
ZSTD_sequenceFormat_e
static final int
ZSTD_frameType_e
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
ZSTD_nextInputType_e
static final int
ZSTD_nextInputType_e
static final int
ZSTD_nextInputType_e
static final int
ZSTD_nextInputType_e
static final int
ZSTD_nextInputType_e
static final int
ZSTD_nextInputType_e
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
nZSTD_adjustCParams
(long cPar, long srcSize, long dictSize, long __result) Unsafe version of:adjustCParams
static long
nZSTD_CCtx_getParameter
(long cctx, int param, long value) Unsafe version of:CCtx_getParameter
static long
nZSTD_CCtx_loadDictionary_advanced
(long cctx, long dict, long dictSize, int dictLoadMethod, int dictContentType) Unsafe version of:CCtx_loadDictionary_advanced
static long
nZSTD_CCtx_loadDictionary_byReference
(long cctx, long dict, long dictSize) Unsafe version of:CCtx_loadDictionary_byReference
static long
nZSTD_CCtx_refPrefix_advanced
(long cctx, long prefix, long prefixSize, int dictContentType) Unsafe version of:CCtx_refPrefix_advanced
static long
nZSTD_CCtx_refThreadPool
(long cctx, long pool) Unsafe version of:CCtx_refThreadPool
static long
nZSTD_CCtx_setCParams
(long cctx, long cparams) Unsafe version of:CCtx_setCParams
static long
nZSTD_CCtx_setFParams
(long cctx, long fparams) Unsafe version of:CCtx_setFParams
static long
nZSTD_CCtx_setParametersUsingCCtxParams
(long cctx, long params) Unsafe version of:CCtx_setParametersUsingCCtxParams
static long
nZSTD_CCtx_setParams
(long cctx, long params) Unsafe version of:CCtx_setParams
static long
nZSTD_CCtxParams_getParameter
(long params, int param, long value) Unsafe version of:CCtxParams_getParameter
static long
nZSTD_CCtxParams_init
(long cctxParams, int compressionLevel) Unsafe version of:CCtxParams_init
static long
nZSTD_CCtxParams_init_advanced
(long cctxParams, long params) Unsafe version of:CCtxParams_init_advanced
static long
nZSTD_CCtxParams_reset
(long params) Unsafe version of:CCtxParams_reset
static long
nZSTD_CCtxParams_setParameter
(long params, int param, int value) Unsafe version of:CCtxParams_setParameter
static long
nZSTD_checkCParams
(long params) Unsafe version of:checkCParams
static long
nZSTD_compressSequences
(long cctx, long dst, long dstSize, long inSeqs, long inSeqsSize, long src, long srcSize) Unsafe version of:compressSequences
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
static long
nZSTD_createCCtx_advanced
(long customMem) static long
nZSTD_createCDict_advanced
(long dict, long dictSize, int dictLoadMethod, int dictContentType, long cParams, long customMem) Unsafe version of:createCDict_advanced
static long
nZSTD_createCDict_advanced2
(long dict, long dictSize, int dictLoadMethod, int dictContentType, long cctxParams, long customMem) Unsafe version of:createCDict_advanced2
static long
nZSTD_createCDict_byReference
(long dictBuffer, long dictSize, int compressionLevel) Unsafe version of:createCDict_byReference
static long
nZSTD_createCStream_advanced
(long customMem) static long
nZSTD_createDCtx_advanced
(long customMem) static long
nZSTD_createDDict_advanced
(long dict, long dictSize, int dictLoadMethod, int dictContentType, long customMem) Unsafe version of:createDDict_advanced
static long
nZSTD_createDDict_byReference
(long dictBuffer, long dictSize) Unsafe version of:createDDict_byReference
static long
nZSTD_createDStream_advanced
(long customMem) static long
nZSTD_DCtx_getParameter
(long dctx, int param, long value) Unsafe version of:DCtx_getParameter
static long
nZSTD_DCtx_loadDictionary_advanced
(long dctx, long dict, long dictSize, int dictLoadMethod, int dictContentType) Unsafe version of:DCtx_loadDictionary_advanced
static long
nZSTD_DCtx_loadDictionary_byReference
(long dctx, long dict, long dictSize) Unsafe version of:DCtx_loadDictionary_byReference
static long
nZSTD_DCtx_refPrefix_advanced
(long dctx, long prefix, long prefixSize, int dictContentType) Unsafe version of:DCtx_refPrefix_advanced
static long
nZSTD_DCtx_setMaxWindowSize
(long dctx, long maxWindowSize) Unsafe version of:DCtx_setMaxWindowSize
static long
nZSTD_decompressBegin
(long dctx) static long
nZSTD_decompressBegin_usingDDict
(long dctx, long ddict) static long
nZSTD_decompressBegin_usingDict
(long dctx, long dict, long dictSize) static long
nZSTD_decompressBound
(long src, long srcSize) Unsafe version of:decompressBound
static long
nZSTD_decompressContinue
(long dctx, long dst, long dstCapacity, long src, long srcSize) static long
nZSTD_decompressionMargin
(long src, long srcSize) Unsafe version of:decompressionMargin
static long
nZSTD_decompressStream_simpleArgs
(long dctx, long dst, long dstCapacity, long dstPos, long src, long srcSize, long srcPos) Unsafe version of:decompressStream_simpleArgs
static long
nZSTD_estimateCCtxSize_usingCCtxParams
(long params) static long
nZSTD_estimateCCtxSize_usingCParams
(long cParams) static long
nZSTD_estimateCDictSize_advanced
(long dictSize, long cParams, int dictLoadMethod) Unsafe version of:estimateCDictSize_advanced
static long
nZSTD_estimateCStreamSize_usingCCtxParams
(long params) static long
nZSTD_estimateCStreamSize_usingCParams
(long cParams) static long
nZSTD_estimateDStreamSize_fromFrame
(long src, long srcSize) static long
nZSTD_findDecompressedSize
(long src, long srcSize) Unsafe version of:findDecompressedSize
static long
nZSTD_frameHeaderSize
(long src, long srcSize) Unsafe version of:frameHeaderSize
static long
nZSTD_generateSequences
(long zc, long outSeqs, long outSeqsSize, long src, long srcSize) Unsafe version of:generateSequences
static void
nZSTD_getCParams
(int compressionLevel, long estimatedSrcSize, long dictSize, long __result) Unsafe version of:getCParams
static long
nZSTD_getFrameHeader
(long zfhPtr, long src, long srcSize) Unsafe version of:getFrameHeader
static long
nZSTD_getFrameHeader_advanced
(long zfhPtr, long src, long srcSize, int format) Unsafe version of:getFrameHeader_advanced
static void
nZSTD_getFrameProgression
(long cctx, long __result) Unsafe version of:getFrameProgression
static void
nZSTD_getParams
(int compressionLevel, long estimatedSrcSize, long dictSize, long __result) Unsafe version of:getParams
static long
nZSTD_initStaticCCtx
(long workspace, long workspaceSize) static long
nZSTD_initStaticCDict
(long workspace, long workspaceSize, long dict, long dictSize, int dictLoadMethod, int dictContentType, long cParams) Unsafe version of:initStaticCDict
static long
nZSTD_initStaticCStream
(long workspace, long workspaceSize) static long
nZSTD_initStaticDCtx
(long workspace, long workspaceSize) static long
nZSTD_initStaticDDict
(long workspace, long workspaceSize, long dict, long dictSize, int dictLoadMethod, int dictContentType) Unsafe version of:initStaticDDict
static long
nZSTD_initStaticDStream
(long workspace, long workspaceSize) static int
nZSTD_isFrame
(long buffer, long size) Unsafe version of:isFrame
static int
nZSTD_isSkippableFrame
(long buffer, long size) Unsafe version of:isSkippableFrame
static long
nZSTD_mergeBlockDelimiters
(long sequences, long seqsSize) Unsafe version of:mergeBlockDelimiters
static int
nZSTD_nextInputType
(long dctx) static long
nZSTD_nextSrcSizeToDecompress
(long dctx) static long
nZSTD_readSkippableFrame
(long dst, long dstCapacity, long magicVariant, long src, long srcSize) Unsafe version of:readSkippableFrame
static void
nZSTD_registerSequenceProducer
(long cctx, long sequenceProducerState, long sequenceProducer) Unsafe version of:registerSequenceProducer
static long
nZSTD_toFlushNow
(long cctx) Unsafe version of:toFlushNow
static long
nZSTD_writeSkippableFrame
(long dst, long dstCapacity, long src, long srcSize, int magicVariant) Unsafe version of:writeSkippableFrame
static ZSTDCompressionParameters
ZSTD_adjustCParams
(ZSTDCompressionParameters cPar, long srcSize, long dictSize, ZSTDCompressionParameters __result) Optimizes params for a givensrcSize
anddictSize
.static long
ZSTD_CCtx_getParameter
(long cctx, int param, IntBuffer value) Gets the requested compression parameter value, selected byenum ZSTD_cParameter
, and stores it intoint* value
.static long
ZSTD_CCtx_loadDictionary_advanced
(long cctx, ByteBuffer dict, int dictLoadMethod, int dictContentType) Same asCCtx_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 ?).static long
ZSTD_CCtx_loadDictionary_byReference
(long cctx, ByteBuffer dict) Same asCCtx_loadDictionary
, but dictionary content is referenced, instead of being copied intoCCtx
.static long
ZSTD_CCtx_refPrefix_advanced
(long cctx, ByteBuffer prefix, int dictContentType) Same asCCtx_refPrefix
, but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?).static long
ZSTD_CCtx_refThreadPool
(long cctx, long pool) Assigns a thread pool to a context (useNULL
argument value to use an internal thread pool).static long
ZSTD_CCtx_setCParams
(long cctx, ZSTDCompressionParameters cparams) Set all parameters provided withincparams
into the workingcctx
.static long
ZSTD_CCtx_setFParams
(long cctx, ZSTDFrameParameters fparams) Set all parameters provided withinfparams
into the workingcctx
.static long
ZSTD_CCtx_setParametersUsingCCtxParams
(long cctx, long params) Applies a set ofZSTD_CCtx_params
to the compression context.static long
ZSTD_CCtx_setParams
(long cctx, ZSTDParameters params) Set all parameters provided withinparams
into the workingcctx
.static long
ZSTD_CCtxParams_getParameter
(long params, int param, IntBuffer value) Similar toCCtx_getParameter
.static long
ZSTD_CCtxParams_init
(long cctxParams, int compressionLevel) Initializes the compression parameters ofcctxParams
according to compression level.static long
ZSTD_CCtxParams_init_advanced
(long cctxParams, ZSTDParameters params) Initializes the compression and frame parameters ofcctxParams
according to params.static long
ZSTD_CCtxParams_reset
(long params) Resets params to default values.static long
ZSTD_CCtxParams_setParameter
(long params, int param, int value) Similar toCCtx_setParameter
.static long
Ensures param values remain within authorized range.static long
ZSTD_compressSequences
(long cctx, ByteBuffer dst, ZSTDSequence.Buffer inSeqs, ByteBuffer src) Compress an array ofZSTD_Sequence
, associated withsrc
buffer, intodst
.static long
ZSTD_compressStream2_simpleArgs
(long cctx, ByteBuffer dst, PointerBuffer dstPos, ByteBuffer src, PointerBuffer srcPos, int endOp) Same ascompressStream2
, but using only integral types as arguments.static long
ZSTD_createCCtx_advanced
(ZSTDCustomMem customMem) static long
Creates aZSTD_CCtx_params
structure.static long
ZSTD_createCDict_advanced
(ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams, ZSTDCustomMem customMem) static long
ZSTD_createCDict_advanced2
(ByteBuffer dict, int dictLoadMethod, int dictContentType, long cctxParams, ZSTDCustomMem customMem) static long
ZSTD_createCDict_byReference
(ByteBuffer dictBuffer, int compressionLevel) Creates a digested dictionary for compression Dictionary content is just referenced, not duplicated.static long
ZSTD_createCStream_advanced
(ZSTDCustomMem customMem) static long
ZSTD_createDCtx_advanced
(ZSTDCustomMem customMem) static long
ZSTD_createDDict_advanced
(ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCustomMem customMem) static long
ZSTD_createDDict_byReference
(ByteBuffer dictBuffer) Creates a digested dictionary, ready to start decompression operation without startup delay.static long
ZSTD_createDStream_advanced
(ZSTDCustomMem customMem) static long
ZSTD_createThreadPool
(long numThreads) Creates a new thread pool with a given number of threads.static long
ZSTD_DCtx_getParameter
(long dctx, int param, IntBuffer value) Gets the requested decompression parameter value, selected by enumZSTD_dParameter
, and store it intoint*
value.static long
ZSTD_DCtx_loadDictionary_advanced
(long dctx, ByteBuffer dict, int dictLoadMethod, int dictContentType) Same asDCtx_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 ?).static long
ZSTD_DCtx_loadDictionary_byReference
(long dctx, ByteBuffer dict) static long
ZSTD_DCtx_refPrefix_advanced
(long dctx, ByteBuffer prefix, int dictContentType) Same asDCtx_refPrefix
, but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?).static long
ZSTD_DCtx_setMaxWindowSize
(long dctx, long maxWindowSize) Refuses allocating internal buffers for frames requiring a window size larger than provided limit.static long
ZSTD_decodingBufferSize_min
(long windowSize, long frameContentSize) static long
ZSTD_decompressBegin
(long dctx) static long
ZSTD_decompressBegin_usingDDict
(long dctx, long ddict) static long
ZSTD_decompressBegin_usingDict
(long dctx, ByteBuffer dict) static long
Note 1: an error can occur ifsrc
contains an invalid or incorrectly formatted frame.static long
ZSTD_decompressContinue
(long dctx, ByteBuffer dst, ByteBuffer src) static long
ZSTD_DECOMPRESSION_MARGIN
(long originalSize, long blockSize) Similar todecompressionMargin
, but instead of computing the margin from the compressed frame, compute it from the originalsize
and theblockSizeLog
.static long
Zstd supports in-place decompression, where the input and output buffers overlap.static long
ZSTD_decompressStream_simpleArgs
(long dctx, ByteBuffer dst, PointerBuffer dstPos, ByteBuffer src, PointerBuffer srcPos) Same asdecompressStream
, but using only integral types as arguments.static long
ZSTD_estimateCCtxSize
(int compressionLevel) Estimages memory usage of a futureCCtx
, before its creation.static long
ZSTD_estimateCCtxSize_usingCCtxParams
(long params) static long
static long
ZSTD_estimateCDictSize
(long dictSize, int compressionLevel) static long
ZSTD_estimateCDictSize_advanced
(long dictSize, ZSTDCompressionParameters cParams, int dictLoadMethod) static long
ZSTD_estimateCStreamSize
(int compressionLevel) Provides a budget large enough for any compression level up to selected one.static long
ZSTD_estimateCStreamSize_usingCCtxParams
(long params) static long
static long
static long
ZSTD_estimateDDictSize
(long dictSize, int dictLoadMethod) static long
ZSTD_estimateDStreamSize
(long windowSize) static long
static long
Note 1: decompressed size is an optional field, that may not be present, especially in streaming mode.static long
static int
ZSTD_FRAMEHEADERSIZE_MIN
(int format) static int
ZSTD_FRAMEHEADERSIZE_PREFIX
(int format) static long
ZSTD_freeCCtxParams
(long params) static void
ZSTD_freeThreadPool
(long pool) Frees a thread pool.static long
ZSTD_generateSequences
(long zc, ZSTDSequence.Buffer outSeqs, ByteBuffer src) Generate sequences usingcompress2
, given a source buffer.static ZSTDCompressionParameters
ZSTD_getCParams
(int compressionLevel, long estimatedSrcSize, long dictSize, ZSTDCompressionParameters __result) ReturnsZSTD_compressionParameters
structure for a selected compression level and estimatedsrcSize
.static long
ZSTD_getFrameHeader
(ZSTDFrameHeader zfhPtr, ByteBuffer src) Decode Frame Header, or requires largersrcSize
.static long
ZSTD_getFrameHeader_advanced
(ZSTDFrameHeader zfhPtr, ByteBuffer src, int format) Same asgetFrameHeader
, with added capability to select a format (likef_zstd1_magicless
).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.static ZSTDParameters
ZSTD_getParams
(int compressionLevel, long estimatedSrcSize, long dictSize, ZSTDParameters __result) Same as getCParams(), but returns a fullZSTD_parameters
object instead of sub-componentZSTD_compressionParameters
.static long
ZSTD_initStaticCCtx
(ByteBuffer workspace) static long
ZSTD_initStaticCDict
(ByteBuffer workspace, ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams) static long
ZSTD_initStaticCStream
(ByteBuffer workspace) static long
ZSTD_initStaticDCtx
(ByteBuffer workspace) static long
ZSTD_initStaticDDict
(ByteBuffer workspace, ByteBuffer dict, int dictLoadMethod, int dictContentType) static long
ZSTD_initStaticDStream
(ByteBuffer workspace) static boolean
ZSTD_isFrame
(ByteBuffer buffer) Tells if the content ofbuffer
starts with a valid Frame Identifier.static boolean
ZSTD_isSkippableFrame
(ByteBuffer buffer) Tells if the content ofbuffer
starts with a valid Frame Identifier for a skippable frame.static long
ZSTD_mergeBlockDelimiters
(ZSTDSequence.Buffer sequences) Given an array ofZSTD_Sequence
, remove all sequences that represent block delimiters/last literals by merging them into the literals of the next sequence.static int
ZSTD_nextInputType
(long dctx) static long
ZSTD_nextSrcSizeToDecompress
(long dctx) static long
ZSTD_readSkippableFrame
(ByteBuffer dst, IntBuffer magicVariant, ByteBuffer src) Retrieves a zstd skippable frame containing data given bysrc
, and writes it todst
buffer.static void
ZSTD_registerSequenceProducer
(long cctx, long sequenceProducerState, ZSTDSequenceProducerI sequenceProducer) Instruct zstd to use a block-level external sequence producer function.static long
ZSTD_sequenceBound
(long srcSize) static long
ZSTD_toFlushNow
(long cctx) Tells how many bytes are ready to be flushed immediately.static long
ZSTD_writeSkippableFrame
(ByteBuffer dst, ByteBuffer src, int magicVariant) Generates a zstd skippable frame containing data given bysrc
, and writes it todst
buffer.
-
Field Details
-
ZSTD_dct_auto
public static final int ZSTD_dct_autoZSTD_dictContentType_e
Enum values:
dct_auto
- dictionary is "full" when starting withMAGIC_DICTIONARY
, otherwise it is "rawContent"dct_rawContent
- ensures dictionary is always loaded asrawContent
, even if it starts withZSTD_MAGIC_DICTIONARY
dct_fullDict
- refuses to load a dictionary if it does not respect Zstandard's specification, starting withZSTD_MAGIC_DICTIONARY
- See Also:
-
ZSTD_dct_rawContent
public static final int ZSTD_dct_rawContentZSTD_dictContentType_e
Enum values:
dct_auto
- dictionary is "full" when starting withMAGIC_DICTIONARY
, otherwise it is "rawContent"dct_rawContent
- ensures dictionary is always loaded asrawContent
, even if it starts withZSTD_MAGIC_DICTIONARY
dct_fullDict
- refuses to load a dictionary if it does not respect Zstandard's specification, starting withZSTD_MAGIC_DICTIONARY
- See Also:
-
ZSTD_dct_fullDict
public static final int ZSTD_dct_fullDictZSTD_dictContentType_e
Enum values:
dct_auto
- dictionary is "full" when starting withMAGIC_DICTIONARY
, otherwise it is "rawContent"dct_rawContent
- ensures dictionary is always loaded asrawContent
, even if it starts withZSTD_MAGIC_DICTIONARY
dct_fullDict
- refuses to load a dictionary if it does not respect Zstandard's specification, starting withZSTD_MAGIC_DICTIONARY
- See Also:
-
ZSTD_dlm_byCopy
public static final int ZSTD_dlm_byCopyZSTD_dictLoadMethod_e
Enum values:
dlm_byCopy
- Copy dictionary content internallydlm_byRef
- Reference dictionary content -- the dictionary buffer must outlive its users.
- See Also:
-
ZSTD_dlm_byRef
public static final int ZSTD_dlm_byRefZSTD_dictLoadMethod_e
Enum values:
dlm_byCopy
- Copy dictionary content internallydlm_byRef
- Reference dictionary content -- the dictionary buffer must outlive its users.
- See Also:
-
ZSTD_f_zstd1
public static final int ZSTD_f_zstd1ZSTD_format_e
Enum values:
f_zstd1
- zstd frame format, specified inzstd_compression_format.md
(default)f_zstd1_magicless
- Variant of zstd frame format, without initial 4-bytes magic number. Useful to save 4 bytes per generated frame. Decoder cannot recognise automatically this format, requiring this instruction.
- See Also:
-
ZSTD_f_zstd1_magicless
public static final int ZSTD_f_zstd1_magiclessZSTD_format_e
Enum values:
f_zstd1
- zstd frame format, specified inzstd_compression_format.md
(default)f_zstd1_magicless
- Variant of zstd frame format, without initial 4-bytes magic number. Useful to save 4 bytes per generated frame. Decoder cannot recognise automatically this format, requiring this instruction.
- See Also:
-
ZSTD_d_validateChecksum
public static final int ZSTD_d_validateChecksum- See Also:
-
ZSTD_d_ignoreChecksum
public static final int ZSTD_d_ignoreChecksum- See Also:
-
ZSTD_rmd_refSingleDDict
public static final int ZSTD_rmd_refSingleDDict- See Also:
-
ZSTD_rmd_refMultipleDDicts
public static final int ZSTD_rmd_refMultipleDDicts- See Also:
-
ZSTD_dictDefaultAttach
public static final int ZSTD_dictDefaultAttachZSTD_dictAttachPref_e
Enum values:
dictDefaultAttach
- Use the default heuristic.dictForceAttach
- Never copy the dictionary.dictForceCopy
- Always copy the dictionary.dictForceLoad
- Always reload the dictionary.
- See Also:
-
ZSTD_dictForceAttach
public static final int ZSTD_dictForceAttachZSTD_dictAttachPref_e
Enum values:
dictDefaultAttach
- Use the default heuristic.dictForceAttach
- Never copy the dictionary.dictForceCopy
- Always copy the dictionary.dictForceLoad
- Always reload the dictionary.
- See Also:
-
ZSTD_dictForceCopy
public static final int ZSTD_dictForceCopyZSTD_dictAttachPref_e
Enum values:
dictDefaultAttach
- Use the default heuristic.dictForceAttach
- Never copy the dictionary.dictForceCopy
- Always copy the dictionary.dictForceLoad
- Always reload the dictionary.
- See Also:
-
ZSTD_dictForceLoad
public static final int ZSTD_dictForceLoadZSTD_dictAttachPref_e
Enum values:
dictDefaultAttach
- Use the default heuristic.dictForceAttach
- Never copy the dictionary.dictForceCopy
- Always copy the dictionary.dictForceLoad
- Always reload the dictionary.
- See Also:
-
ZSTD_frame
public static final int ZSTD_frame- See Also:
-
ZSTD_skippableFrame
public static final int ZSTD_skippableFrame- See Also:
-
ZSTDnit_frameHeader
public static final int ZSTDnit_frameHeaderZSTD_nextInputType_e
Enum values:
- See Also:
-
ZSTDnit_blockHeader
public static final int ZSTDnit_blockHeaderZSTD_nextInputType_e
Enum values:
- See Also:
-
ZSTDnit_block
public static final int ZSTDnit_blockZSTD_nextInputType_e
Enum values:
- See Also:
-
ZSTDnit_lastBlock
public static final int ZSTDnit_lastBlockZSTD_nextInputType_e
Enum values:
- See Also:
-
ZSTDnit_checksum
public static final int ZSTDnit_checksumZSTD_nextInputType_e
Enum values:
- See Also:
-
ZSTDnit_skippableFrame
public static final int ZSTDnit_skippableFrameZSTD_nextInputType_e
Enum values:
- See Also:
-
ZSTD_FRAMEHEADERSIZE_MAX
public static final int ZSTD_FRAMEHEADERSIZE_MAX- See Also:
-
ZSTD_SKIPPABLEHEADERSIZE
public static final int ZSTD_SKIPPABLEHEADERSIZE- See Also:
-
ZSTD_WINDOWLOG_MAX_32
public static final int ZSTD_WINDOWLOG_MAX_32- See Also:
-
ZSTD_WINDOWLOG_MAX_64
public static final int ZSTD_WINDOWLOG_MAX_64- See Also:
-
ZSTD_WINDOWLOG_MAX
public static final int ZSTD_WINDOWLOG_MAX -
ZSTD_WINDOWLOG_MIN
public static final int ZSTD_WINDOWLOG_MIN- See Also:
-
ZSTD_HASHLOG_MAX
public static final int ZSTD_HASHLOG_MAX -
ZSTD_HASHLOG_MIN
public static final int ZSTD_HASHLOG_MIN- See Also:
-
ZSTD_CHAINLOG_MAX_32
public static final int ZSTD_CHAINLOG_MAX_32- See Also:
-
ZSTD_CHAINLOG_MAX_64
public static final int ZSTD_CHAINLOG_MAX_64- See Also:
-
ZSTD_CHAINLOG_MAX
public static final int ZSTD_CHAINLOG_MAX -
ZSTD_CHAINLOG_MIN
public static final int ZSTD_CHAINLOG_MIN- See Also:
-
ZSTD_SEARCHLOG_MIN
public static final int ZSTD_SEARCHLOG_MIN- See Also:
-
ZSTD_MINMATCH_MAX
public static final int ZSTD_MINMATCH_MAX- See Also:
-
ZSTD_MINMATCH_MIN
public static final int ZSTD_MINMATCH_MIN- See Also:
-
ZSTD_TARGETLENGTH_MAX
public static final int ZSTD_TARGETLENGTH_MAX- See Also:
-
ZSTD_TARGETLENGTH_MIN
public static final int ZSTD_TARGETLENGTH_MIN- See Also:
-
ZSTD_STRATEGY_MIN
public static final int ZSTD_STRATEGY_MIN- See Also:
-
ZSTD_STRATEGY_MAX
public static final int ZSTD_STRATEGY_MAX- See Also:
-
ZSTD_BLOCKSIZE_MAX_MIN
public static final int ZSTD_BLOCKSIZE_MAX_MINThe minimum valid max blocksize. Maximum blocksizes smaller than this make compressBound() inaccurate.- See Also:
-
ZSTD_OVERLAPLOG_MIN
public static final int ZSTD_OVERLAPLOG_MIN- See Also:
-
ZSTD_OVERLAPLOG_MAX
public static final int ZSTD_OVERLAPLOG_MAX- See Also:
-
ZSTD_WINDOWLOG_LIMIT_DEFAULT
public static final int ZSTD_WINDOWLOG_LIMIT_DEFAULT- See Also:
-
ZSTD_LDM_HASHLOG_MIN
public static final int ZSTD_LDM_HASHLOG_MIN- See Also:
-
ZSTD_LDM_HASHLOG_MAX
public static final int ZSTD_LDM_HASHLOG_MAX -
ZSTD_LDM_MINMATCH_MIN
public static final int ZSTD_LDM_MINMATCH_MIN- See Also:
-
ZSTD_LDM_MINMATCH_MAX
public static final int ZSTD_LDM_MINMATCH_MAX- See Also:
-
ZSTD_LDM_BUCKETSIZELOG_MIN
public static final int ZSTD_LDM_BUCKETSIZELOG_MIN- See Also:
-
ZSTD_LDM_BUCKETSIZELOG_MAX
public static final int ZSTD_LDM_BUCKETSIZELOG_MAX- See Also:
-
ZSTD_LDM_HASHRATELOG_MIN
public static final int ZSTD_LDM_HASHRATELOG_MIN- See Also:
-
ZSTD_TARGETCBLOCKSIZE_MIN
public static final int ZSTD_TARGETCBLOCKSIZE_MIN- See Also:
-
ZSTD_TARGETCBLOCKSIZE_MAX
public static final int ZSTD_TARGETCBLOCKSIZE_MAX- See Also:
-
ZSTD_SRCSIZEHINT_MIN
public static final int ZSTD_SRCSIZEHINT_MIN- See Also:
-
ZSTD_SRCSIZEHINT_MAX
public static final int ZSTD_SRCSIZEHINT_MAX- See Also:
-
ZSTD_c_rsyncable
public static final int ZSTD_c_rsyncableEnablesrsyncable mode, which makes compressed files more rsync friendly by adding periodic synchronization points to the compressed data.
The target average block size isc_jobSize
/ 2. It's possible to modify the job size to increase or decrease the granularity of the synchronization point. Once thejobSize
is smaller than the window size, it will result in compression ratio degradation.NOTE 1:
rsyncable
mode only works when multithreading is enabled.NOTE 2:
rsyncable
performs poorly in combination with long range mode, since it will decrease the effectiveness of synchronization points, though mileage may vary.NOTE 3:
Rsyncable
mode limits maximum compression speed to ~400 MB/s. If the selected compression level is already running significantly slower, the overall speed won't be significantly impacted.- See Also:
-
ZSTD_c_format
public static final int ZSTD_c_formatSelect a compression format.The value must be of type
ZSTD_format_e
.- See Also:
-
ZSTD_c_forceMaxWindow
public static final int ZSTD_c_forceMaxWindowForce back-reference distances to remain <windowSize
, even when referencing into Dictionary content. (default:0)- See Also:
-
ZSTD_c_forceAttachDict
public static final int ZSTD_c_forceAttachDictControls whether the contents of aCDict
are used in place, or copied into the working context.Accepts values from the
ZSTD_dictAttachPref_e
enum.- See Also:
-
ZSTD_c_literalCompressionMode
public static final int ZSTD_c_literalCompressionModeControlled withZSTD_paramSwitch_e
enum.- Default is
ps_auto
. - Set to
ps_disable
to never compress literals. - Set to
ps_enable
to always compress literals. (Note: uncompressed literals may still be emitted if huffman is not beneficial to use.)
By default, in
ZSTD_ps_auto
, the library will decide at runtime whether to use literals compression based on the compression parameters - specifically, negative compression levels do not use literal compression.- See Also:
- Default is
-
ZSTD_c_targetCBlockSize
public static final int ZSTD_c_targetCBlockSizeTries to fit compressed block size to be aroundtargetCBlockSize
.No target when
targetCBlockSize == 0
. There is no guarantee on compressed block size. (default:0)- See Also:
-
ZSTD_c_srcSizeHint
public static final int ZSTD_c_srcSizeHintUser's best guess of source size.Hint is not valid when
srcSizeHint == 0
. There is no guarantee that hint is close to actual source size, but compression ratio may regress significantly if guess considerably underestimates.- See Also:
-
ZSTD_c_enableDedicatedDictSearch
public static final int ZSTD_c_enableDedicatedDictSearchControls whether the new and experimental "dedicated dictionary search structure" can be used. This feature is still rough around the edges, be prepared for surprising behavior!How to use it:
When using a
CDict
, whether to use this feature or not is controlled atCDict
creation, and it must be set in aCCtxParams
set passed into that construction (viacreateCDict_advanced2
). A compression will then use the feature or not based on how theCDict
was constructed; the value of this param, set in theCCtx
, will have no effect.However, when a dictionary buffer is passed into a
CCtx
, such as viaCCtx_loadDictionary
, this param can be set on theCCtx
to control whether theCDict
that is created internally can use the feature or not.What it does:
Normally, the internal data structures of the
CDict
are analogous to what would be stored in aCCtx
after compressing the contents of a dictionary. To an approximation, a compression using a dictionary can then use those data structures to simply continue what is effectively a streaming compression where the simulated compression of the dictionary left off. Which is to say, the search structures in theCDict
are normally the same format as in theCCtx
.It is possible to do better, since the
CDict
is not like aCCtx
: the search structures are written once duringCDict
creation, and then are only read after that, while the search structures in theCCtx
are both read and written as the compression goes along. This means we can choose a search structure for the dictionary that is read-optimized.This feature enables the use of that different structure.
Note that some of the members of the
ZSTD_compressionParameters
struct have different semantics and constraints in the dedicated search structure. It is highly recommended that you simply set a compression level in theCCtxParams
you pass into theCDict
creation call, and avoid messing with thecParams
directly.Effects:
This will only have any effect when the selected
ZSTD_strategy
implementation supports this feature. Currently, that's limited togreedy
,lazy
, andlazy2
.Note that this means that the
CDict
tables can no longer be copied into theCCtx
, so thedict
attachment modedictForceCopy
will no longer be usable. The dictionary can only be attached or reloaded.In general, you should expect compression to be faster--sometimes very much so--and
CDict
creation to be slightly slower. Eventually, we will probably make this mode the default.- See Also:
-
ZSTD_c_stableInBuffer
public static final int ZSTD_c_stableInBufferExperimental parameter. Default is0 == disabled
. Set to 1 to enable.Tells the compressor that input data presented with
ZSTD_inBuffer
will ALWAYS be the same between calls. Technically, thesrc
pointer must never be changed, and thepos
field can only be updated by zstd. However, it's possible to increase thesize
field, allowing scenarios where more data can be appended after compressions starts. These conditions are checked by the compressor, and compression will fail if they are not respected. Also, data in theZSTD_inBuffer
within the range[src, src + pos)
MUST not be modified during compression or it will result in data corruption.When this flag is enabled zstd won't allocate an input window buffer, because the user guarantees it can reference the
ZSTD_inBuffer
until the frame is complete. But, it will still allocate an output buffer large enough to fit a block (seec_stableOutBuffer
). This will also avoid thememcpy()
from the input buffer to the input window buffer.NOTE: So long as the
ZSTD_inBuffer
always points to valid memory, using this flag is ALWAYS memory safe, and will never access out-of-bounds memory. However, compression WILL fail if conditions are not respected.WARNING: The data in the
ZSTD_inBuffer
in the range[src, src + pos)
MUST not be modified during compression or it will result in data corruption. This is because zstd needs to reference data in theZSTD_inBuffer
to find matches. Normally zstd maintains its own window buffer for this purpose, but passing this flag tells zstd to rely on user provided buffer instead.- See Also:
-
ZSTD_c_stableOutBuffer
public static final int ZSTD_c_stableOutBufferExperimental parameter. Default is0 == disabled
. Set to 1 to enable.Tells he compressor that the
ZSTD_outBuffer
will not be resized between calls. Specifically:(out.size - out.pos)
will never grow. This gives the compressor the freedom to say: If the compressed data doesn't fit in the output buffer then returnerror_dstSize_tooSmall
. This allows us to always decompress directly into the output buffer, instead of decompressing into an internal buffer and copying to the output buffer.When this flag is enabled zstd won't allocate an output buffer, because it can write directly to the
ZSTD_outBuffer
. It will still allocate the input window buffer (seec_stableInBuffer
).Zstd will check that
(out.size - out.pos)
never grows and return an error if it does. While not strictly necessary, this should prevent surprises.- See Also:
-
ZSTD_c_blockDelimiters
public static final int ZSTD_c_blockDelimitersDefault is0 == ZSTD_sf_noBlockDelimiters
.For use with sequence compression API:
compressSequences
.Designates whether or not the given array of
ZSTD_Sequence
contains block delimiters and last literals, which are defined as sequences withoffset == 0
andmatchLength == 0
. See the definition ofZSTD_Sequence
for more specifics.- See Also:
-
ZSTD_c_validateSequences
public static final int ZSTD_c_validateSequencesDefault is0 == disabled
. Set to 1 to enable sequence validation.For use with sequence compression API:
compressSequences
. Designates whether or not we validate sequences provided toZSTD_compressSequences()
during function execution.Without validation, providing a sequence that does not conform to the zstd spec will cause undefined behavior, and may produce a corrupted block.
With validation enabled, if sequence is invalid (see
doc/zstd_compression_format.md
for specifics regardingoffset
/matchlength
requirements) then the function will bail out and return an error.- See Also:
-
ZSTD_c_useBlockSplitter
public static final int ZSTD_c_useBlockSplitterControlled withZSTD_paramSwitch_e
enum.- Default is
ps_auto
. - Set to
ps_disable
to never use block splitter. - Set to
ps_enable
to always use block splitter.
By default, in
ZSTD_ps_auto
, the library will decide at runtime whether to use block splitting based on the compression parameters.- See Also:
- Default is
-
ZSTD_c_useRowMatchFinder
public static final int ZSTD_c_useRowMatchFinderControlled withZSTD_paramSwitch_e
enum.- Default is
ps_auto
. - Set to
ps_disable
to never use row-based matchfinder. - Set to
ps_enable
to force usage of row-based matchfinder.
By default, in
ZSTD_ps_auto
, the library will decide at runtime whether to use the row-based matchfinder based on support for SIMD instructions and the window log. Note that this only pertains to compression strategies:greedy
,lazy
, andlazy2
.- See Also:
- Default is
-
ZSTD_c_deterministicRefPrefix
public static final int ZSTD_c_deterministicRefPrefixDefault is0 == disabled
. Set to 1 to enable.Zstd produces different results for prefix compression when the prefix is directly adjacent to the data about to be compressed vs. when it isn't. This is because zstd detects that the two buffers are contiguous and it can use a more efficient match finding algorithm. However, this produces different results than when the two buffers are non-contiguous. This flag forces zstd to always load the prefix in non-contiguous mode, even if it happens to be adjacent to the data, to guarantee determinism.
If you really care about determinism when using a dictionary or prefix, like when doing delta compression, you should select this option. It comes at a speed penalty of about ~2.5% if the dictionary and data happened to be contiguous, and is free if they weren't contiguous. We don't expect that intentionally making the dictionary and data contiguous will be worth the cost to
memcpy()
the data.- See Also:
-
ZSTD_c_prefetchCDictTables
public static final int ZSTD_c_prefetchCDictTablesControlled with ZSTD_paramSwitch_e enum. Default is ZSTD_ps_auto.In some situations, zstd uses CDict tables in-place rather than copying them into the working context. (See docs on
ZSTD_dictAttachPref_e
for details). In such situations, compression speed is seriously impacted when CDict tables are "cold" (outside CPU cache). This parameter instructs zstd to prefetch CDict tables when they are used in-place.For sufficiently small inputs, the cost of the prefetch will outweigh the benefit. For sufficiently large inputs, zstd will by default
memcpy()
CDict tables into the working context, so there is no need to prefetch. This parameter is targeted at a middle range of input sizes, where a prefetch is cheap enough to be useful butmemcpy()
is too expensive. The exact range of input sizes where this makes sense is best determined by careful experimentation.Note: for this parameter,
ps_auto
is currently equivalent tops_disable
, but in the future zstd may conditionally enable this feature via an auto-detection heuristic for cold CDicts. UseZSTD_ps_disable
to opt out of prefetching under any circumstances.- See Also:
-
ZSTD_c_enableSeqProducerFallback
public static final int ZSTD_c_enableSeqProducerFallbackAllowed values are 0 (disable) and 1 (enable). The default setting is 0.Controls whether zstd will fall back to an internal sequence producer if an external sequence producer is registered and returns an error code. This fallback is block-by-block: the internal sequence producer will only be called for blocks where the external sequence producer returns an error code. Fallback parsing will follow any other cParam settings, such as compression level, the same as in a normal (fully-internal) compression operation.
The user is strongly encouraged to read the full Block-Level Sequence Producer API documentation (below) before setting this parameter.
- See Also:
-
ZSTD_c_maxBlockSize
public static final int ZSTD_c_maxBlockSizeAllowed values are between 1KB andBLOCKSIZE_MAX
(128KB). The default isZSTD_BLOCKSIZE_MAX
, and setting to 0 will set to the default.This parameter can be used to set an upper bound on the blocksize that overrides the default
ZSTD_BLOCKSIZE_MAX
. It cannot be used to set upper bounds greater thanZSTD_BLOCKSIZE_MAX
or bounds lower than 1KB (will makecompressBound
inaccurate). Only currently meant to be used for testing.- See Also:
-
ZSTD_c_searchForExternalRepcodes
public static final int ZSTD_c_searchForExternalRepcodesThis parameter affects how zstd parses external sequences, such as sequences provided through thecompressSequences
API or from an external block-level sequence producer.If set to
ps_enable
, the library will check for repeated offsets in external sequences, even if those repcodes are not explicitly indicated in the "rep" field. Note that this is the only way to exploit repcode matches while usingcompressSequences()
or an external sequence producer, since zstd currently ignores the "rep" field of external sequences.If set to
ps_disable
, the library will not exploit repeated offsets in external sequences, regardless of whether the "rep" field has been set. This reduces sequence compression overhead by about 25% while sacrificing some compression ratio.The default value is
ps_auto
, for which the library will enable/disable based on compression level.Note: for now, this param only has an effect if
c_blockDelimiters
is set tosf_explicitBlockDelimiters
. That may change in the future.- See Also:
-
ZSTD_d_format
public static final int ZSTD_d_formatExperimental parameter.Allows selection between
ZSTD_format_e
input compression formats.- See Also:
-
ZSTD_d_stableOutBuffer
public static final int ZSTD_d_stableOutBufferExperimental parameter. Default is 0 == disabled. Set to 1 to enable.Tells the decompressor that the
ZSTD_outBuffer
will ALWAYS be the same between calls, except for the modifications that zstd makes topos
(the caller must not modifypos
). This is checked by the decompressor, and decompression will fail if it ever changes. Therefore theZSTD_outBuffer
MUST be large enough to fit the entire decompressed frame. This will be checked when the frame content size is known. The data in theZSTD_outBuffer
in the range[dst, dst + pos)
MUST not be modified during decompression or you will get data corruption.When this flag is enabled zstd won't allocate an output buffer, because it can write directly to the
ZSTD_outBuffer
, but it will still allocate an input buffer large enough to fit any compressed block. This will also avoid thememcpy()
from the internal output buffer to theZSTD_outBuffer
. If you need to avoid the input buffer allocation use the buffer-less streaming API.NOTE: So long as the
ZSTD_outBuffer
always points to valid memory, using this flag is ALWAYS memory safe, and will never access out-of-bounds memory. However, decompression WILL fail if you violate the preconditions.WARNING: The data in the
ZSTD_outBuffer
in the range[dst, dst + pos)
MUST not be modified during decompression or you will get data corruption. This is because zstd needs to reference data in theZSTD_outBuffer
to regenerate matches. Normally zstd maintains its own buffer for this purpose, but passing this flag tells zstd to use the user provided buffer.- See Also:
-
ZSTD_d_forceIgnoreChecksum
public static final int ZSTD_d_forceIgnoreChecksumExperimental parameter. Default is0 == disabled
. Set to 1 to enableTells the decompressor to skip checksum validation during decompression, regardless of whether checksumming was specified during compression. This offers some slight performance benefits, and may be useful for debugging. Param has values of type
ZSTD_forceIgnoreChecksum_e
.- See Also:
-
ZSTD_d_refMultipleDDicts
public static final int ZSTD_d_refMultipleDDictsExperimental parameter. Default is0 == disabled
. Set to 1 to enableIf enabled and
dctx
is allocated on the heap, then additional memory will be allocated to store references to multipleZSTD_DDict
. That is, multiple calls ofDCtx_refDDict
using a givenZSTD_DCtx
, rather than overwriting the previousDDict
reference, will instead store all references. At decompression time, the appropriatedictID
is selected from the set ofDDicts
based on thedictID
in the frame.Usage is simply calling
ZSTD_DCtx_refDDict()
on multiple dict buffers.Param has values of byte
ZSTD_refMultipleDDicts_e
.WARNING: Enabling this parameter and calling
ZSTD_DCtx_refDDict()
, will trigger memory allocation for the hash table.freeDCtx
also frees this memory. Memory is allocated as perZSTD_DCtx::customMem
.Although this function allocates memory for the table, the user is still responsible for memory management of the underlying
ZSTD_DDict
themselves.- See Also:
-
ZSTD_d_disableHuffmanAssembly
public static final int ZSTD_d_disableHuffmanAssemblySet to 1 to disable the Huffman assembly implementation.The default value is 0, which allows zstd to use the Huffman assembly implementation if available.
This parameter can be used to disable Huffman assembly at runtime. If you want to disable it at compile time you can define the macro
ZSTD_DISABLE_ASM
.- See Also:
-
ZSTD_lcm_auto
public static final int ZSTD_lcm_autoZSTD_literalCompressionMode_e
Enum values:
lcm_auto
- Automatically determine the compression mode based on the compression level.Negative compression levels will be uncompressed, and positive compression levels will be compressed.
lcm_huffman
- Always attempt Huffman compression. Uncompressed literals will still be emitted if Huffman compression is not profitable.lcm_uncompressed
- Always emit uncompressed literals.
- See Also:
-
ZSTD_lcm_huffman
public static final int ZSTD_lcm_huffmanZSTD_literalCompressionMode_e
Enum values:
lcm_auto
- Automatically determine the compression mode based on the compression level.Negative compression levels will be uncompressed, and positive compression levels will be compressed.
lcm_huffman
- Always attempt Huffman compression. Uncompressed literals will still be emitted if Huffman compression is not profitable.lcm_uncompressed
- Always emit uncompressed literals.
- See Also:
-
ZSTD_lcm_uncompressed
public static final int ZSTD_lcm_uncompressedZSTD_literalCompressionMode_e
Enum values:
lcm_auto
- Automatically determine the compression mode based on the compression level.Negative compression levels will be uncompressed, and positive compression levels will be compressed.
lcm_huffman
- Always attempt Huffman compression. Uncompressed literals will still be emitted if Huffman compression is not profitable.lcm_uncompressed
- Always emit uncompressed literals.
- See Also:
-
ZSTD_ps_auto
public static final int ZSTD_ps_autoZSTD_paramSwitch_e
This enum controls features which are conditionally beneficial. Zstd typically will make a final decision on whether or not to enable the feature (
ZSTD_ps_auto
), but setting the switch toZSTD_ps_enable
orZSTD_ps_disable
allow for a force enable/disable the feature.Enum values:
ps_auto
- Let the library automatically determine whether the feature shall be enabled.ps_enable
- Force-enable the feature.ps_disable
- Do not use the feature.
- See Also:
-
ZSTD_ps_enable
public static final int ZSTD_ps_enableZSTD_paramSwitch_e
This enum controls features which are conditionally beneficial. Zstd typically will make a final decision on whether or not to enable the feature (
ZSTD_ps_auto
), but setting the switch toZSTD_ps_enable
orZSTD_ps_disable
allow for a force enable/disable the feature.Enum values:
ps_auto
- Let the library automatically determine whether the feature shall be enabled.ps_enable
- Force-enable the feature.ps_disable
- Do not use the feature.
- See Also:
-
ZSTD_ps_disable
public static final int ZSTD_ps_disableZSTD_paramSwitch_e
This enum controls features which are conditionally beneficial. Zstd typically will make a final decision on whether or not to enable the feature (
ZSTD_ps_auto
), but setting the switch toZSTD_ps_enable
orZSTD_ps_disable
allow for a force enable/disable the feature.Enum values:
ps_auto
- Let the library automatically determine whether the feature shall be enabled.ps_enable
- Force-enable the feature.ps_disable
- Do not use the feature.
- See Also:
-
ZSTD_sf_noBlockDelimiters
public static final int ZSTD_sf_noBlockDelimitersZSTD_sequenceFormat_e
Enum values:
sf_noBlockDelimiters
- Representation ofZSTD_Sequence
has no block delimiters, sequences only.sf_explicitBlockDelimiters
- Representation ofZSTD_Sequence
contains explicit block delimiters.
- See Also:
-
ZSTD_sf_explicitBlockDelimiters
public static final int ZSTD_sf_explicitBlockDelimitersZSTD_sequenceFormat_e
Enum values:
sf_noBlockDelimiters
- Representation ofZSTD_Sequence
has no block delimiters, sequences only.sf_explicitBlockDelimiters
- Representation ofZSTD_Sequence
contains explicit block delimiters.
- See Also:
-
ZSTD_SEQUENCE_PRODUCER_ERROR
public static final long ZSTD_SEQUENCE_PRODUCER_ERROR- See Also:
-
-
Method Details
-
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 atsrcSize
bytes aftersrc + srcSize
)
-
ZSTD_findDecompressedSize
Note 1: decompressed size is an optional field, that may not be present, especially in streaming mode. Whenreturn==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:
- decompressed size of all data in all successive frames
- if the decompressed size cannot be determined:
CONTENTSIZE_UNKNOWN
- if an error occurred:
CONTENTSIZE_ERROR
-
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 atsrc + srcSize
)
-
ZSTD_decompressBound
Note 1: an error can occur ifsrc
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
andZSTD_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 occurred
-
nZSTD_frameHeaderSize
public static long nZSTD_frameHeaderSize(long src, long srcSize) Unsafe version of:frameHeaderSize
- Parameters:
srcSize
- must be ≥ZSTD_FRAMEHEADERSIZE_PREFIX(int)
-
ZSTD_frameHeaderSize
- Returns:
- : size of the Frame Header, or an error code (if srcSize is too small)
-
nZSTD_getFrameHeader
public static long nZSTD_getFrameHeader(long zfhPtr, long src, long srcSize) Unsafe version of:getFrameHeader
-
ZSTD_getFrameHeader
Decode Frame Header, or requires largersrcSize
.- Returns:
- 0,
zfhPtr
is correctly filled, >0,srcSize
is too small, value is wantedsrcSize
amount, or an error code, which can be tested usingisError
-
nZSTD_getFrameHeader_advanced
public static long nZSTD_getFrameHeader_advanced(long zfhPtr, long src, long srcSize, int format) Unsafe version of:getFrameHeader_advanced
-
ZSTD_getFrameHeader_advanced
Same asgetFrameHeader
, with added capability to select a format (likef_zstd1_magicless
).- Parameters:
format
- one of:f_zstd1
f_zstd1_magicless
-
nZSTD_decompressionMargin
public static long nZSTD_decompressionMargin(long src, long srcSize) Unsafe version of:decompressionMargin
- Parameters:
srcSize
- the size of the compressed frame(s)
-
ZSTD_decompressionMargin
Zstd supports in-place decompression, where the input and output buffers overlap. In this case, the output buffer must be at least(Margin + Output_Size)
bytes large, and the input buffer must be at the end of the output buffer._______________________ Output Buffer ________________________ | | | ____ Input Buffer ____| | | | v v v |---------------------------------------|-----------|----------| ^ ^ ^ |___________________ Output_Size ___________________|_ Margin _|
This applies only to single-pass decompression through
decompress
ordecompressDCtx
. This function supports multi-frame input.- Parameters:
src
- the compressed frame(s)- Returns:
- the decompression margin or an error that can be checked with
isError
.
-
ZSTD_sequenceBound
public static long ZSTD_sequenceBound(long srcSize) - Parameters:
srcSize
- size of the input buffer- Returns:
- upper-bound for the number of sequences that can be generated from a buffer of
srcSize
bytes
-
nZSTD_generateSequences
public static long nZSTD_generateSequences(long zc, long outSeqs, long outSeqsSize, long src, long srcSize) Unsafe version of:generateSequences
-
ZSTD_generateSequences
Generate sequences usingcompress2
, given a source buffer.Each block will end with a dummy sequence with
offset == 0
,matchLength == 0
, andlitLength == length
of last literals.litLength
may be== 0
, and if so, then the sequence of(of: 0 ml: 0 ll: 0)
simply acts as a block delimiter.zc
can be used to insert custom compression params. This function invokescompress2
The output of this function can be fed into
compressSequences
withCCtx
setting ofc_blockDelimiters
assf_explicitBlockDelimiters
.- Returns:
- number of sequences generated
-
nZSTD_mergeBlockDelimiters
public static long nZSTD_mergeBlockDelimiters(long sequences, long seqsSize) Unsafe version of:mergeBlockDelimiters
-
ZSTD_mergeBlockDelimiters
Given an array ofZSTD_Sequence
, remove all sequences that represent block delimiters/last literals by merging them into the literals of the next sequence.As such, the final generated result has no explicit representation of block boundaries, and the final last literals segment is not represented in the sequences.
The output of this function can be fed into
compressSequences
withCCtx
setting ofc_blockDelimiters
assf_noBlockDelimiters
.- Returns:
- number of sequences left after merging
-
nZSTD_compressSequences
public static long nZSTD_compressSequences(long cctx, long dst, long dstSize, long inSeqs, long inSeqsSize, long src, long srcSize) Unsafe version of:compressSequences
-
ZSTD_compressSequences
public static long ZSTD_compressSequences(long cctx, ByteBuffer dst, ZSTDSequence.Buffer inSeqs, ByteBuffer src) Compress an array ofZSTD_Sequence
, associated withsrc
buffer, intodst
.src
contains the entire input (not just the literals). IfsrcSize
>sum(sequence.length)
, the remaining bytes are considered all literals.If a dictionary is included, then the
cctx
should reference thedict
. (see:CCtx_refCDict
,CCtx_loadDictionary
, etc.) The entire source is compressed into a single frame.The compression behavior changes based on
cctx
params. In particular:- If
ZSTD_c_blockDelimiters == ZSTD_sf_noBlockDelimiters
, the array ofZSTD_Sequence
is expected to contain no block delimiters (defined inZSTD_Sequence
). Block boundaries are roughly determined based on the block size derived from thecctx
, and sequences may be split. This is the default setting. - If
ZSTD_c_blockDelimiters == ZSTD_sf_explicitBlockDelimiters
, the array ofZSTD_Sequence
is expected to contain block delimiters (defined inZSTD_Sequence
). Behavior is undefined if no block delimiters are provided. - If
ZSTD_c_validateSequences == 0
, this function will blindly accept the sequences provided. Invalid sequences cause undefined behavior. IfZSTD_c_validateSequences == 1
, then if sequence is invalid (seedoc/zstd_compression_format.md
for specifics regarding offset/matchlength requirements) then the function will bail out and return an error.
In addition to the two adjustable experimental params, there are other important cctx params.
c_minMatch
MUST be set as less than or equal to the smallest match generated by the match finder. It has a minimum value ofMINMATCH_MIN
.c_compressionLevel
accordingly adjusts the strength of the entropy coder, as it would in typical compression.c_windowLog
affects offset validation: this function will return an error at higher debug levels if a provided offset is larger than what the spec allows for a given window log and dictionary (if present). See:doc/zstd_compression_format.md
Note: Repcodes are, as of now, always re-calculated within this function, so
ZSTD_Sequence::rep
is unused.Note 2: Once we integrate ability to ingest repcodes, the explicit block delims mode must respect those repcodes exactly, and cannot emit an RLE block that disagrees with the
repcode
history.- Returns:
- final compressed size, or a ZSTD error code.
- If
-
nZSTD_writeSkippableFrame
public static long nZSTD_writeSkippableFrame(long dst, long dstCapacity, long src, long srcSize, int magicVariant) Unsafe version of:writeSkippableFrame
-
ZSTD_writeSkippableFrame
Generates a zstd skippable frame containing data given bysrc
, and writes it todst
buffer.Skippable frames begin with a 4-byte magic number. There are 16 possible choices of magic number, ranging from
MAGIC_SKIPPABLE_START
toZSTD_MAGIC_SKIPPABLE_START+15
. As such, the parametermagicVariant
controls the exact skippable frame magic number variant used, so the magic number used will beZSTD_MAGIC_SKIPPABLE_START + magicVariant
.Returns an error if destination buffer is not large enough, if the source size is not representable with a 4-byte unsigned int, or if the parameter
magicVariant
is greater than 15 (and therefore invalid).- Returns:
- number of bytes written or a ZSTD error
-
nZSTD_readSkippableFrame
public static long nZSTD_readSkippableFrame(long dst, long dstCapacity, long magicVariant, long src, long srcSize) Unsafe version of:readSkippableFrame
-
ZSTD_readSkippableFrame
public static long ZSTD_readSkippableFrame(ByteBuffer dst, @Nullable IntBuffer magicVariant, ByteBuffer src) Retrieves a zstd skippable frame containing data given bysrc
, and writes it todst
buffer.The parameter
magicVariant
will receive themagicVariant
that was supplied when the frame was written, i.e.magicNumber - ZSTD_MAGIC_SKIPPABLE_START
. This can beNULL
if the caller is not interested in themagicVariant
.Returns an error if destination buffer is not large enough, or if the frame is not skippable.
- Returns:
- number of bytes written or a ZSTD error
-
nZSTD_isSkippableFrame
public static int nZSTD_isSkippableFrame(long buffer, long size) Unsafe version of:isSkippableFrame
-
ZSTD_isSkippableFrame
Tells if the content ofbuffer
starts with a valid Frame Identifier for a skippable frame. -
ZSTD_estimateCCtxSize
public static long ZSTD_estimateCCtxSize(int compressionLevel) Estimages memory usage of a futureCCtx
, before its creation.ZSTD_estimateCCtxSize()
will provide a memory budget large enough for any compression level up to selected one.Note: Unlike
ZSTD_estimateCStreamSize*()
, this estimate does not include space for a window buffer. Therefore, the estimation is only guaranteed for single-shot compressions, not streaming.The estimate will assume the input may be arbitrarily large, which is the worst case.
When
srcSize
can be bound by a known and rather "small" value, this fact can be used to provide a tighter estimation because the CCtx compression context will need less memory. This tighter estimation can be provided by more advanced functionsestimateCCtxSize_usingCParams
, which can be used in tandem withgetCParams
, andestimateCCtxSize_usingCCtxParams
, which can be used in tandem withCCtxParams_setParameter
. Both can be used to estimate memory using custom compression parameters and arbitrarysrcSize
limits.Note: only single-threaded compression is supported.
estimateCCtxSize_usingCCtxParams
will return an error code ifc_nbWorkers
is ≥ 1.Note 2:
ZSTD_estimateCCtxSize*
functions are not compatible with the Block-Level Sequence Producer API at this time. Size estimates assume that no external sequence producer is registered. -
nZSTD_estimateCCtxSize_usingCParams
public static long nZSTD_estimateCCtxSize_usingCParams(long cParams) -
ZSTD_estimateCCtxSize_usingCParams
-
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. IfsrcSize
is known to always be small,estimateCStreamSize_usingCParams
can provide a tighter estimation.ZSTD_estimateCStreamSize_usingCParams()
can be used in tandem withgetCParams
to createcParams
from compressionLevel.estimateCStreamSize_usingCCtxParams
can be used in tandem withCCtxParams_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 windowSize
. This information can be passed manually, usingestimateDStreamSize
, or deducted from a valid frameHeader
, usingestimateDStreamSize_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 addingZSTD_estimate?DictSize
.Note 2: only single-threaded compression is supported.
estimateCStreamSize_usingCCtxParams
will return an error code ifc_nbWorkers
is ≥ 1.Note 3:
ZSTD_estimateCStreamSize*
functions are not compatible with the Block-Level Sequence Producer API at this time. Size estimates assume that no external sequence producer is registered. -
nZSTD_estimateCStreamSize_usingCParams
public static long nZSTD_estimateCStreamSize_usingCParams(long cParams) -
ZSTD_estimateCStreamSize_usingCParams
-
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
-
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
public static long ZSTD_estimateCDictSize_advanced(long dictSize, ZSTDCompressionParameters cParams, int dictLoadMethod) - Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
-
ZSTD_estimateDDictSize
public static long ZSTD_estimateDDictSize(long dictSize, int dictLoadMethod) - Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
-
nZSTD_initStaticCCtx
public static long nZSTD_initStaticCCtx(long workspace, long workspaceSize) -
ZSTD_initStaticCCtx
-
nZSTD_initStaticCStream
public static long nZSTD_initStaticCStream(long workspace, long workspaceSize) -
ZSTD_initStaticCStream
-
nZSTD_initStaticDCtx
public static long nZSTD_initStaticDCtx(long workspace, long workspaceSize) -
ZSTD_initStaticDCtx
-
nZSTD_initStaticDStream
public static long nZSTD_initStaticDStream(long workspace, long workspaceSize) -
ZSTD_initStaticDStream
-
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
-
ZSTD_initStaticCDict
public static long ZSTD_initStaticCDict(ByteBuffer workspace, ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams) - Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
dictContentType
- one of:dct_auto
dct_rawContent
dct_fullDict
-
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(ByteBuffer workspace, ByteBuffer dict, int dictLoadMethod, int dictContentType) - Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
dictContentType
- one of:dct_auto
dct_rawContent
dct_fullDict
-
nZSTD_createCCtx_advanced
public static long nZSTD_createCCtx_advanced(long customMem) -
ZSTD_createCCtx_advanced
-
nZSTD_createCStream_advanced
public static long nZSTD_createCStream_advanced(long customMem) -
ZSTD_createCStream_advanced
-
nZSTD_createDCtx_advanced
public static long nZSTD_createDCtx_advanced(long customMem) -
ZSTD_createDCtx_advanced
-
nZSTD_createDStream_advanced
public static long nZSTD_createDStream_advanced(long customMem) -
ZSTD_createDStream_advanced
-
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
-
ZSTD_createCDict_advanced
public static long ZSTD_createCDict_advanced(ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams, ZSTDCustomMem customMem) - Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
dictContentType
- one of:dct_auto
dct_rawContent
dct_fullDict
-
ZSTD_createThreadPool
public static long ZSTD_createThreadPool(long numThreads) Creates a new thread pool with a given number of threads.Note that the lifetime of such pool must exist while being used.
-
ZSTD_freeThreadPool
public static void ZSTD_freeThreadPool(long pool) Frees a thread pool.- Parameters:
pool
- acceptsNULL
pointer
-
nZSTD_CCtx_refThreadPool
public static long nZSTD_CCtx_refThreadPool(long cctx, long pool) Unsafe version of:CCtx_refThreadPool
-
ZSTD_CCtx_refThreadPool
public static long ZSTD_CCtx_refThreadPool(long cctx, long pool) Assigns a thread pool to a context (useNULL
argument value to use an internal thread pool). -
nZSTD_createCDict_advanced2
public static long nZSTD_createCDict_advanced2(long dict, long dictSize, int dictLoadMethod, int dictContentType, long cctxParams, long customMem) Unsafe version of:createCDict_advanced2
-
ZSTD_createCDict_advanced2
public static long ZSTD_createCDict_advanced2(ByteBuffer dict, int dictLoadMethod, int dictContentType, long cctxParams, ZSTDCustomMem customMem) - Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
dictContentType
- one of:dct_auto
dct_rawContent
dct_fullDict
-
nZSTD_createDDict_advanced
public static long nZSTD_createDDict_advanced(long dict, long dictSize, int dictLoadMethod, int dictContentType, long customMem) Unsafe version of:createDDict_advanced
-
ZSTD_createDDict_advanced
public static long ZSTD_createDDict_advanced(ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCustomMem customMem) - Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
dictContentType
- one of:dct_auto
dct_rawContent
dct_fullDict
-
nZSTD_createCDict_byReference
public static long nZSTD_createCDict_byReference(long dictBuffer, long dictSize, int compressionLevel) Unsafe version of:createCDict_byReference
-
ZSTD_createCDict_byReference
Creates a digested dictionary for compression Dictionary content is just referenced, not duplicated.As a consequence,
dictBuffer
must outliveCDict
, and its content must remain unmodified throughout the lifetime ofCDict
.Note: equivalent to
createCDict_advanced
, withdictLoadMethod==ZSTD_dlm_byRef
. -
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) ReturnsZSTD_compressionParameters
structure for a selected compression level and estimatedsrcSize
.- 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 fullZSTD_parameters
object instead of sub-componentZSTD_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
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
-
ZSTD_adjustCParams
public static ZSTDCompressionParameters ZSTD_adjustCParams(ZSTDCompressionParameters cPar, long srcSize, long dictSize, ZSTDCompressionParameters __result) Optimizes params for a givensrcSize
anddictSize
. Both values are optional, select 0 if unknown. -
nZSTD_CCtx_setCParams
public static long nZSTD_CCtx_setCParams(long cctx, long cparams) Unsafe version of:CCtx_setCParams
-
ZSTD_CCtx_setCParams
Set all parameters provided withincparams
into the workingcctx
.Note: if modifying parameters during compression (MT mode only), note that changes to the
.windowLog
parameter will be ignored.- Returns:
- 0 on success, or an error code (can be checked with
isError
). On failure, no parameters are updated.
-
nZSTD_CCtx_setFParams
public static long nZSTD_CCtx_setFParams(long cctx, long fparams) Unsafe version of:CCtx_setFParams
-
ZSTD_CCtx_setFParams
Set all parameters provided withinfparams
into the workingcctx
. -
nZSTD_CCtx_setParams
public static long nZSTD_CCtx_setParams(long cctx, long params) Unsafe version of:CCtx_setParams
-
ZSTD_CCtx_setParams
Set all parameters provided withinparams
into the workingcctx
. -
nZSTD_CCtx_loadDictionary_byReference
public static long nZSTD_CCtx_loadDictionary_byReference(long cctx, long dict, long dictSize) Unsafe version of:CCtx_loadDictionary_byReference
-
ZSTD_CCtx_loadDictionary_byReference
Same asCCtx_loadDictionary
, but dictionary content is referenced, instead of being copied intoCCtx
.It saves some memory, but also requires that
dict
outlives its usage withincctx
. -
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, ByteBuffer dict, int dictLoadMethod, int dictContentType) Same asCCtx_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_byCopy
dlm_byRef
dictContentType
- one of:dct_auto
dct_rawContent
dct_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
Same asCCtx_refPrefix
, but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?).- Parameters:
dictContentType
- one of:dct_auto
dct_rawContent
dct_fullDict
-
nZSTD_CCtx_getParameter
public static long nZSTD_CCtx_getParameter(long cctx, int param, long value) Unsafe version of:CCtx_getParameter
-
ZSTD_CCtx_getParameter
Gets the requested compression parameter value, selected byenum ZSTD_cParameter
, and stores it intoint* value
.- Parameters:
param
- one of:- Returns:
- 0, or an error code (which can be tested with
isError
)
-
ZSTD_createCCtxParams
public static long ZSTD_createCCtxParams()Creates aZSTD_CCtx_params
structure. -
ZSTD_freeCCtxParams
public static long ZSTD_freeCCtxParams(long params) - Parameters:
params
- acceptsNULL
pointer
-
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 ofcctxParams
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
Initializes the compression and frame parameters ofcctxParams
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
-
ZSTD_CCtxParams_setParameter
public static long ZSTD_CCtxParams_setParameter(long params, int param, int value) Similar toCCtx_setParameter
. Sets one compression parameter, selected byenum ZSTD_cParameter
.Parameters must be applied to a
ZSTD_CCtx
usingCCtx_setParametersUsingCCtxParams
.- Parameters:
param
- one of:- Returns:
- a code representing success or failure (which can be tested with
isError
)
-
nZSTD_CCtxParams_getParameter
public static long nZSTD_CCtxParams_getParameter(long params, int param, long value) Unsafe version of:CCtxParams_getParameter
-
ZSTD_CCtxParams_getParameter
Similar toCCtx_getParameter
. Gets the requested value of one compression parameter, selected byenum ZSTD_cParameter
.- Parameters:
param
- one of:- Returns:
- 0, or an error code (which can be tested with
isError
)
-
nZSTD_CCtx_setParametersUsingCCtxParams
public static long nZSTD_CCtx_setParametersUsingCCtxParams(long cctx, long params) Unsafe version of:CCtx_setParametersUsingCCtxParams
-
ZSTD_CCtx_setParametersUsingCCtxParams
public static long ZSTD_CCtx_setParametersUsingCCtxParams(long cctx, long params) Applies a set ofZSTD_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. IfnbWorkers
≥ 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, ByteBuffer dst, PointerBuffer dstPos, ByteBuffer src, PointerBuffer srcPos, int endOp) Same ascompressStream2
, 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_continue
e_flush
e_end
-
nZSTD_isFrame
public static int nZSTD_isFrame(long buffer, long size) Unsafe version of:isFrame
-
ZSTD_isFrame
Tells if the content ofbuffer
starts with a valid Frame Identifier.Notes:
- Frame Identifier is 4 bytes. If
size < 4
,@return
will always be 0. - Legacy Frame Identifiers are considered valid only if Legacy Support is enabled.
- Skippable Frame Identifiers are considered valid.
- Frame Identifier is 4 bytes. If
-
nZSTD_createDDict_byReference
public static long nZSTD_createDDict_byReference(long dictBuffer, long dictSize) Unsafe version of:createDDict_byReference
-
ZSTD_createDDict_byReference
Creates a digested dictionary, ready to start decompression operation without startup delay.Dictionary content is referenced, and therefore stays in
dictBuffer
. It is important thatdictBuffer
outlivesDDict
, it must remain read accessible throughout the lifetime ofDDict
. -
nZSTD_DCtx_loadDictionary_byReference
public static long nZSTD_DCtx_loadDictionary_byReference(long dctx, long dict, long dictSize) Unsafe version of:DCtx_loadDictionary_byReference
-
ZSTD_DCtx_loadDictionary_byReference
Same asDCtx_loadDictionary
, but referencesdict
content instead of copying it intodctx
.This saves memory if
dict
remains around. However, it's imperative thatdict
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, ByteBuffer dict, int dictLoadMethod, int dictContentType) Same asDCtx_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_byCopy
dlm_byRef
dictContentType
- one of:dct_auto
dct_rawContent
dct_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
Same asDCtx_refPrefix
, but gives finer control over how to interpret prefix content (automatic ? force raw mode (default) ? full mode only ?).- Parameters:
dictContentType
- one of:dct_auto
dct_rawContent
dct_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_getParameter
public static long nZSTD_DCtx_getParameter(long dctx, int param, long value) Unsafe version of:DCtx_getParameter
-
ZSTD_DCtx_getParameter
Gets the requested decompression parameter value, selected by enumZSTD_dParameter
, and store it intoint*
value.- Returns:
- 0, or an error code (which can be tested with
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, ByteBuffer dst, PointerBuffer dstPos, ByteBuffer src, PointerBuffer srcPos) Same asdecompressStream
, 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.
- there is no active job (could be checked with
-
nZSTD_registerSequenceProducer
public static void nZSTD_registerSequenceProducer(long cctx, long sequenceProducerState, long sequenceProducer) Unsafe version of:registerSequenceProducer
-
ZSTD_registerSequenceProducer
public static void ZSTD_registerSequenceProducer(long cctx, long sequenceProducerState, @Nullable ZSTDSequenceProducerI sequenceProducer) Instruct zstd to use a block-level external sequence producer function.The
sequenceProducerState
must be initialized by the caller, and the caller is responsible for managing its lifetime. This parameter is sticky across compressions. It will remain set until the user explicitly resets compression parameters.Sequence producer registration is considered to be an "advanced parameter", part of the "advanced API". This means it will only have an effect on compression APIs which respect advanced parameters, such as
compress2
andcompressStream2
. Older compression APIs such ascompressCCtx
, which predate the introduction of "advanced parameters", will ignore any external sequence producer setting.The sequence producer can be "cleared" by registering a
NULL
function pointer. This removes all limitations described above in the "LIMITATIONS" section of the API docs.The user is strongly encouraged to read the full API documentation before calling this function.
-
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
-
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
-
nZSTD_nextInputType
public static int nZSTD_nextInputType(long dctx) -
ZSTD_nextInputType
public static int ZSTD_nextInputType(long dctx) -
ZSTD_FRAMEHEADERSIZE_PREFIX
public static int ZSTD_FRAMEHEADERSIZE_PREFIX(int format) -
ZSTD_FRAMEHEADERSIZE_MIN
public static int ZSTD_FRAMEHEADERSIZE_MIN(int format) -
ZSTD_DECOMPRESSION_MARGIN
public static long ZSTD_DECOMPRESSION_MARGIN(long originalSize, long blockSize) Similar todecompressionMargin
, but instead of computing the margin from the compressed frame, compute it from the originalsize
and theblockSizeLog
.WARNING: This macro does not support multi-frame input, the input must be a single zstd frame. If you need that support use the function, or implement it yourself.
- Parameters:
originalSize
- the original uncompressed size of the datablockSize
- the blocksize == MIN(windowSize, ZSTD_BLOCKSIZE_MAX)
. Unless you explicitly set thewindowLog
smaller thanZSTD_BLOCKSIZELOG_MAX
you can just useZSTD_BLOCKSIZE_MAX
.
-