Class ZstdX
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe minimum valid max blocksize.static final intDefault is0 == ZSTD_sf_noBlockDelimiters.static final intDefault is0 == disabled.static final intControls whether the new and experimental "dedicated dictionary search structure" can be used.static final intAllowed values are 0 (disable) and 1 (enable).static final intControls whether the contents of aCDictare used in place, or copied into the working context.static final intForce back-reference distances to remain <windowSize, even when referencing into Dictionary content.static final intSelect a compression format.static final intControlled withZSTD_paramSwitch_eenum.static final intAllowed values are between 1KB andBLOCKSIZE_MAX(128KB).static final intControlled with ZSTD_paramSwitch_e enum.static final intEnablesrsyncable 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 intThis parameter affects how zstd parses external sequences, such as sequences provided through thecompressSequencesAPI or from an external block-level sequence producer.static final intUser's best guess of source size.static final intExperimental parameter.static final intExperimental parameter.static final intControlled withZSTD_paramSwitch_eenum.static final intControlled withZSTD_paramSwitch_eenum.static final intDefault is0 == disabled.static final intstatic final intstatic final intstatic final intstatic final intSet to 1 to disable the Huffman assembly implementation.static final intExperimental parameter.static final intExperimental parameter.static final intThis enum controlsd_forceIgnoreChecksum.static final intAllowed values are between 1KB andBLOCKSIZE_MAX(128KB).static final intExperimental parameter.static final intExperimental parameter.static final intThis enum controlsd_forceIgnoreChecksum.static final intZSTD_dictContentType_estatic final intZSTD_dictContentType_estatic final intZSTD_dictContentType_estatic final intZSTD_dictAttachPref_estatic final intZSTD_dictAttachPref_estatic final intZSTD_dictAttachPref_estatic final intZSTD_dictAttachPref_estatic final intZSTD_dictLoadMethod_estatic final intZSTD_dictLoadMethod_estatic final intZSTD_format_estatic final intZSTD_format_estatic final intZSTD_frameType_estatic final intstatic final intstatic final intstatic final intZSTD_literalCompressionMode_estatic final intZSTD_literalCompressionMode_estatic final intZSTD_literalCompressionMode_estatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intZSTD_paramSwitch_estatic final intZSTD_paramSwitch_estatic final intZSTD_paramSwitch_estatic final intThis enum controlsd_refMultipleDDicts.static final intThis enum controlsd_refMultipleDDicts.static final intstatic final longstatic final intZSTD_sequenceFormat_estatic final intZSTD_sequenceFormat_estatic final intZSTD_frameType_estatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intSuitable to fit into an ethernet / wifi / 4G transport frame.static final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intZSTD_nextInputType_estatic final intZSTD_nextInputType_estatic final intZSTD_nextInputType_estatic final intZSTD_nextInputType_estatic final intZSTD_nextInputType_estatic final intZSTD_nextInputType_e -
Method Summary
Modifier and TypeMethodDescriptionstatic voidnZSTD_adjustCParams(long cPar, long srcSize, long dictSize, long __result) Unsafe version of:adjustCParamsstatic longnZSTD_CCtx_getParameter(long cctx, int param, long value) Unsafe version of:CCtx_getParameterstatic longnZSTD_CCtx_loadDictionary_advanced(long cctx, long dict, long dictSize, int dictLoadMethod, int dictContentType) Unsafe version of:CCtx_loadDictionary_advancedstatic longnZSTD_CCtx_loadDictionary_byReference(long cctx, long dict, long dictSize) Unsafe version of:CCtx_loadDictionary_byReferencestatic longnZSTD_CCtx_refPrefix_advanced(long cctx, long prefix, long prefixSize, int dictContentType) Unsafe version of:CCtx_refPrefix_advancedstatic longnZSTD_CCtx_refThreadPool(long cctx, long pool) Unsafe version of:CCtx_refThreadPoolstatic longnZSTD_CCtx_setCParams(long cctx, long cparams) Unsafe version of:CCtx_setCParamsstatic longnZSTD_CCtx_setFParams(long cctx, long fparams) Unsafe version of:CCtx_setFParamsstatic longnZSTD_CCtx_setParametersUsingCCtxParams(long cctx, long params) Unsafe version of:CCtx_setParametersUsingCCtxParamsstatic longnZSTD_CCtx_setParams(long cctx, long params) Unsafe version of:CCtx_setParamsstatic longnZSTD_CCtxParams_getParameter(long params, int param, long value) Unsafe version of:CCtxParams_getParameterstatic longnZSTD_CCtxParams_init(long cctxParams, int compressionLevel) Unsafe version of:CCtxParams_initstatic longnZSTD_CCtxParams_init_advanced(long cctxParams, long params) Unsafe version of:CCtxParams_init_advancedstatic voidnZSTD_CCtxParams_registerSequenceProducer(long params, long sequenceProducerState, long sequenceProducer) Unsafe version of:CCtxParams_registerSequenceProducerstatic longnZSTD_CCtxParams_reset(long params) Unsafe version of:CCtxParams_resetstatic longnZSTD_CCtxParams_setParameter(long params, int param, int value) Unsafe version of:CCtxParams_setParameterstatic longnZSTD_checkCParams(long params) Unsafe version of:checkCParamsstatic longnZSTD_compressSequences(long cctx, long dst, long dstSize, long inSeqs, long inSeqsSize, long src, long srcSize) Unsafe version of:compressSequencesstatic longnZSTD_compressStream2_simpleArgs(long cctx, long dst, long dstCapacity, long dstPos, long src, long srcSize, long srcPos, int endOp) Unsafe version of:compressStream2_simpleArgsstatic longnZSTD_createCCtx_advanced(long customMem) static longnZSTD_createCDict_advanced(long dict, long dictSize, int dictLoadMethod, int dictContentType, long cParams, long customMem) Unsafe version of:createCDict_advancedstatic longnZSTD_createCDict_advanced2(long dict, long dictSize, int dictLoadMethod, int dictContentType, long cctxParams, long customMem) Unsafe version of:createCDict_advanced2static longnZSTD_createCDict_byReference(long dictBuffer, long dictSize, int compressionLevel) Unsafe version of:createCDict_byReferencestatic longnZSTD_createCStream_advanced(long customMem) static longnZSTD_createDCtx_advanced(long customMem) static longnZSTD_createDDict_advanced(long dict, long dictSize, int dictLoadMethod, int dictContentType, long customMem) Unsafe version of:createDDict_advancedstatic longnZSTD_createDDict_byReference(long dictBuffer, long dictSize) Unsafe version of:createDDict_byReferencestatic longnZSTD_createDStream_advanced(long customMem) static longnZSTD_DCtx_getParameter(long dctx, int param, long value) Unsafe version of:DCtx_getParameterstatic longnZSTD_DCtx_loadDictionary_advanced(long dctx, long dict, long dictSize, int dictLoadMethod, int dictContentType) Unsafe version of:DCtx_loadDictionary_advancedstatic longnZSTD_DCtx_loadDictionary_byReference(long dctx, long dict, long dictSize) Unsafe version of:DCtx_loadDictionary_byReferencestatic longnZSTD_DCtx_refPrefix_advanced(long dctx, long prefix, long prefixSize, int dictContentType) Unsafe version of:DCtx_refPrefix_advancedstatic longnZSTD_DCtx_setMaxWindowSize(long dctx, long maxWindowSize) Unsafe version of:DCtx_setMaxWindowSizestatic longnZSTD_decompressBegin(long dctx) static longnZSTD_decompressBegin_usingDDict(long dctx, long ddict) static longnZSTD_decompressBegin_usingDict(long dctx, long dict, long dictSize) static longnZSTD_decompressBound(long src, long srcSize) Unsafe version of:decompressBoundstatic longnZSTD_decompressContinue(long dctx, long dst, long dstCapacity, long src, long srcSize) static longnZSTD_decompressionMargin(long src, long srcSize) Unsafe version of:decompressionMarginstatic longnZSTD_decompressStream_simpleArgs(long dctx, long dst, long dstCapacity, long dstPos, long src, long srcSize, long srcPos) Unsafe version of:decompressStream_simpleArgsstatic longnZSTD_estimateCCtxSize_usingCCtxParams(long params) static longnZSTD_estimateCCtxSize_usingCParams(long cParams) static longnZSTD_estimateCDictSize_advanced(long dictSize, long cParams, int dictLoadMethod) Unsafe version of:estimateCDictSize_advancedstatic longnZSTD_estimateCStreamSize_usingCCtxParams(long params) static longnZSTD_estimateCStreamSize_usingCParams(long cParams) static longnZSTD_estimateDStreamSize_fromFrame(long src, long srcSize) static longnZSTD_findDecompressedSize(long src, long srcSize) Unsafe version of:findDecompressedSizestatic longnZSTD_frameHeaderSize(long src, long srcSize) Unsafe version of:frameHeaderSizestatic voidnZSTD_getCParams(int compressionLevel, long estimatedSrcSize, long dictSize, long __result) Unsafe version of:getCParamsstatic longnZSTD_getFrameHeader(long zfhPtr, long src, long srcSize) Unsafe version of:getFrameHeaderstatic longnZSTD_getFrameHeader_advanced(long zfhPtr, long src, long srcSize, int format) Unsafe version of:getFrameHeader_advancedstatic voidnZSTD_getFrameProgression(long cctx, long __result) Unsafe version of:getFrameProgressionstatic voidnZSTD_getParams(int compressionLevel, long estimatedSrcSize, long dictSize, long __result) Unsafe version of:getParamsstatic longnZSTD_initStaticCCtx(long workspace, long workspaceSize) static longnZSTD_initStaticCDict(long workspace, long workspaceSize, long dict, long dictSize, int dictLoadMethod, int dictContentType, long cParams) Unsafe version of:initStaticCDictstatic longnZSTD_initStaticCStream(long workspace, long workspaceSize) static longnZSTD_initStaticDCtx(long workspace, long workspaceSize) static longnZSTD_initStaticDDict(long workspace, long workspaceSize, long dict, long dictSize, int dictLoadMethod, int dictContentType) Unsafe version of:initStaticDDictstatic longnZSTD_initStaticDStream(long workspace, long workspaceSize) static intnZSTD_isFrame(long buffer, long size) Unsafe version of:isFramestatic intnZSTD_isSkippableFrame(long buffer, long size) Unsafe version of:isSkippableFramestatic longnZSTD_mergeBlockDelimiters(long sequences, long seqsSize) Unsafe version of:mergeBlockDelimitersstatic intnZSTD_nextInputType(long dctx) static longnZSTD_nextSrcSizeToDecompress(long dctx) static longnZSTD_readSkippableFrame(long dst, long dstCapacity, long magicVariant, long src, long srcSize) Unsafe version of:readSkippableFramestatic voidnZSTD_registerSequenceProducer(long cctx, long sequenceProducerState, long sequenceProducer) Unsafe version of:registerSequenceProducerstatic longnZSTD_toFlushNow(long cctx) Unsafe version of:toFlushNowstatic longnZSTD_writeSkippableFrame(long dst, long dstCapacity, long src, long srcSize, int magicVariant) Unsafe version of:writeSkippableFramestatic ZSTDCompressionParametersZSTD_adjustCParams(ZSTDCompressionParameters cPar, long srcSize, long dictSize, ZSTDCompressionParameters __result) Optimizes params for a givensrcSizeanddictSize.static longZSTD_CCtx_getParameter(long cctx, int param, IntBuffer value) Gets the requested compression parameter value, selected byenum ZSTD_cParameter, and stores it intoint* value.static longZSTD_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 longZSTD_CCtx_loadDictionary_byReference(long cctx, ByteBuffer dict) Same asCCtx_loadDictionary, but dictionary content is referenced, instead of being copied intoCCtx.static longZSTD_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 longZSTD_CCtx_refThreadPool(long cctx, long pool) Assigns a thread pool to a context (useNULLargument value to use an internal thread pool).static longZSTD_CCtx_setCParams(long cctx, ZSTDCompressionParameters cparams) Set all parameters provided withincparamsinto the workingcctx.static longZSTD_CCtx_setFParams(long cctx, ZSTDFrameParameters fparams) Set all parameters provided withinfparamsinto the workingcctx.static longZSTD_CCtx_setParametersUsingCCtxParams(long cctx, long params) Applies a set ofZSTD_CCtx_paramsto the compression context.static longZSTD_CCtx_setParams(long cctx, ZSTDParameters params) Set all parameters provided withinparamsinto the workingcctx.static longZSTD_CCtxParams_getParameter(long params, int param, IntBuffer value) Similar toCCtx_getParameter.static longZSTD_CCtxParams_init(long cctxParams, int compressionLevel) Initializes the compression parameters ofcctxParamsaccording to compression level.static longZSTD_CCtxParams_init_advanced(long cctxParams, ZSTDParameters params) Initializes the compression and frame parameters ofcctxParamsaccording to params.static voidZSTD_CCtxParams_registerSequenceProducer(long params, long sequenceProducerState, @Nullable ZSTDSequenceProducerI sequenceProducer) Same asregisterSequenceProducer, but operates onZSTD_CCtx_params.static longZSTD_CCtxParams_reset(long params) Resets params to default values.static longZSTD_CCtxParams_setParameter(long params, int param, int value) Similar toCCtx_setParameter.static longEnsures param values remain within authorized range.static longZSTD_compressSequences(long cctx, ByteBuffer dst, ZSTDSequence.Buffer inSeqs, ByteBuffer src) Compress an array ofZSTD_Sequence, associated withsrcbuffer, intodst.static longZSTD_compressStream2_simpleArgs(long cctx, ByteBuffer dst, org.lwjgl.PointerBuffer dstPos, ByteBuffer src, org.lwjgl.PointerBuffer srcPos, int endOp) Same ascompressStream2, but using only integral types as arguments.static longZSTD_createCCtx_advanced(ZSTDCustomMem customMem) static longCreates aZSTD_CCtx_paramsstructure.static longZSTD_createCDict_advanced(ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams, ZSTDCustomMem customMem) static longZSTD_createCDict_advanced2(ByteBuffer dict, int dictLoadMethod, int dictContentType, long cctxParams, ZSTDCustomMem customMem) static longZSTD_createCDict_byReference(ByteBuffer dictBuffer, int compressionLevel) Creates a digested dictionary for compression Dictionary content is just referenced, not duplicated.static longZSTD_createCStream_advanced(ZSTDCustomMem customMem) static longZSTD_createDCtx_advanced(ZSTDCustomMem customMem) static longZSTD_createDDict_advanced(ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCustomMem customMem) static longZSTD_createDDict_byReference(ByteBuffer dictBuffer) Creates a digested dictionary, ready to start decompression operation without startup delay.static longZSTD_createDStream_advanced(ZSTDCustomMem customMem) static longZSTD_createThreadPool(long numThreads) Creates a new thread pool with a given number of threads.static longZSTD_DCtx_getParameter(long dctx, int param, IntBuffer value) Gets the requested decompression parameter value, selected by enumZSTD_dParameter, and store it intoint*value.static longZSTD_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 longZSTD_DCtx_loadDictionary_byReference(long dctx, ByteBuffer dict) static longZSTD_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 longZSTD_DCtx_setMaxWindowSize(long dctx, long maxWindowSize) Refuses allocating internal buffers for frames requiring a window size larger than provided limit.static longZSTD_decodingBufferSize_min(long windowSize, long frameContentSize) static longZSTD_decompressBegin(long dctx) static longZSTD_decompressBegin_usingDDict(long dctx, long ddict) static longZSTD_decompressBegin_usingDict(long dctx, ByteBuffer dict) static longNote 1: an error can occur ifsrccontains an invalid or incorrectly formatted frame.static longZSTD_decompressContinue(long dctx, ByteBuffer dst, ByteBuffer src) static longZSTD_DECOMPRESSION_MARGIN(long originalSize, long blockSize) Similar todecompressionMargin, but instead of computing the margin from the compressed frame, compute it from the originalsizeand theblockSizeLog.static longZstd supports in-place decompression, where the input and output buffers overlap.static longZSTD_decompressStream_simpleArgs(long dctx, ByteBuffer dst, org.lwjgl.PointerBuffer dstPos, ByteBuffer src, org.lwjgl.PointerBuffer srcPos) Same asdecompressStream, but using only integral types as arguments.static longZSTD_estimateCCtxSize(int maxCompressionLevel) Estimages memory usage of a futureCCtx, before its creation.static longZSTD_estimateCCtxSize_usingCCtxParams(long params) static longstatic longZSTD_estimateCDictSize(long dictSize, int compressionLevel) static longZSTD_estimateCDictSize_advanced(long dictSize, ZSTDCompressionParameters cParams, int dictLoadMethod) static longZSTD_estimateCStreamSize(int maxCompressionLevel) Provides a memory budget large enough for streaming compression using any compression level up to the max specified one.static longZSTD_estimateCStreamSize_usingCCtxParams(long params) static longstatic longstatic longZSTD_estimateDDictSize(long dictSize, int dictLoadMethod) static longZSTD_estimateDStreamSize(long maxWindowSize) static longstatic longNote 1: decompressed size is an optional field, that may not be present, especially in streaming mode.static longstatic intZSTD_FRAMEHEADERSIZE_MIN(int format) static intZSTD_FRAMEHEADERSIZE_PREFIX(int format) static longZSTD_freeCCtxParams(long params) static voidZSTD_freeThreadPool(long pool) Frees a thread pool.static ZSTDCompressionParametersZSTD_getCParams(int compressionLevel, long estimatedSrcSize, long dictSize, ZSTDCompressionParameters __result) ReturnsZSTD_compressionParametersstructure for a selected compression level and estimatedsrcSize.static longZSTD_getFrameHeader(ZSTDFrameHeader zfhPtr, ByteBuffer src) Decode Frame Header, or requires largersrcSize.static longZSTD_getFrameHeader_advanced(ZSTDFrameHeader zfhPtr, ByteBuffer src, int format) Same asgetFrameHeader, with added capability to select a format (likef_zstd1_magicless).static ZSTDFrameProgressionZSTD_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 ZSTDParametersZSTD_getParams(int compressionLevel, long estimatedSrcSize, long dictSize, ZSTDParameters __result) Same as getCParams(), but returns a fullZSTD_parametersobject instead of sub-componentZSTD_compressionParameters.static longZSTD_initStaticCCtx(ByteBuffer workspace) static longZSTD_initStaticCDict(ByteBuffer workspace, ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams) static longZSTD_initStaticCStream(ByteBuffer workspace) static longZSTD_initStaticDCtx(ByteBuffer workspace) static longZSTD_initStaticDDict(ByteBuffer workspace, ByteBuffer dict, int dictLoadMethod, int dictContentType) static longZSTD_initStaticDStream(ByteBuffer workspace) static booleanZSTD_isFrame(ByteBuffer buffer) Tells if the content ofbufferstarts with a valid Frame Identifier.static booleanZSTD_isSkippableFrame(ByteBuffer buffer) Tells if the content ofbufferstarts with a valid Frame Identifier for a skippable frame.static longZSTD_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 intZSTD_nextInputType(long dctx) static longZSTD_nextSrcSizeToDecompress(long dctx) static longZSTD_readSkippableFrame(ByteBuffer dst, @Nullable IntBuffer magicVariant, ByteBuffer src) Retrieves a zstd skippable frame containing data given bysrc, and writes it todstbuffer.static voidZSTD_registerSequenceProducer(long cctx, long sequenceProducerState, @Nullable ZSTDSequenceProducerI sequenceProducer) Instruct zstd to use a block-level external sequence producer function.static longZSTD_sequenceBound(long srcSize) static longZSTD_toFlushNow(long cctx) Tells how many bytes are ready to be flushed immediately.static longZSTD_writeSkippableFrame(ByteBuffer dst, ByteBuffer src, int magicVariant) Generates a zstd skippable frame containing data given bysrc, and writes it todstbuffer.
-
Field Details
-
ZSTD_dct_auto
public static final int ZSTD_dct_autoZSTD_dictContentType_eEnum 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_DICTIONARYdct_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_eEnum 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_DICTIONARYdct_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_eEnum 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_DICTIONARYdct_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_eEnum 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_eEnum 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_eEnum 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_eEnum 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_eEnum 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_eEnum 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_eEnum 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_eEnum 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_eEnum values:
- See Also:
-
ZSTDnit_blockHeader
public static final int ZSTDnit_blockHeaderZSTD_nextInputType_eEnum values:
- See Also:
-
ZSTDnit_block
public static final int ZSTDnit_blockZSTD_nextInputType_eEnum values:
- See Also:
-
ZSTDnit_lastBlock
public static final int ZSTDnit_lastBlockZSTD_nextInputType_eEnum values:
- See Also:
-
ZSTDnit_checksum
public static final int ZSTDnit_checksumZSTD_nextInputType_eEnum values:
- See Also:
-
ZSTDnit_skippableFrame
public static final int ZSTDnit_skippableFrameZSTD_nextInputType_eEnum 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_MINSuitable to fit into an ethernet / wifi / 4G transport frame.- 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 thejobSizeis smaller than the window size, it will result in compression ratio degradation.NOTE 1:
rsyncablemode only works when multithreading is enabled.NOTE 2:
rsyncableperforms poorly in combination with long range mode, since it will decrease the effectiveness of synchronization points, though mileage may vary.NOTE 3:
Rsyncablemode 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 aCDictare used in place, or copied into the working context.Accepts values from the
ZSTD_dictAttachPref_eenum.- See Also:
-
ZSTD_c_literalCompressionMode
public static final int ZSTD_c_literalCompressionModeControlled withZSTD_paramSwitch_eenum.- Default is
ps_auto. - Set to
ps_disableto never compress literals. - Set to
ps_enableto 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_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 atCDictcreation, and it must be set in aCCtxParamsset passed into that construction (viacreateCDict_advanced2). A compression will then use the feature or not based on how theCDictwas 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 theCCtxto control whether theCDictthat is created internally can use the feature or not.What it does:
Normally, the internal data structures of the
CDictare analogous to what would be stored in aCCtxafter 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 theCDictare normally the same format as in theCCtx.It is possible to do better, since the
CDictis not like aCCtx: the search structures are written once duringCDictcreation, and then are only read after that, while the search structures in theCCtxare 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_compressionParametersstruct have different semantics and constraints in the dedicated search structure. It is highly recommended that you simply set a compression level in theCCtxParamsyou pass into theCDictcreation call, and avoid messing with thecParamsdirectly.Effects:
This will only have any effect when the selected
ZSTD_strategyimplementation supports this feature. Currently, that's limited togreedy,lazy, andlazy2.Note that this means that the
CDicttables can no longer be copied into theCCtx, so thedictattachment modedictForceCopywill 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
CDictcreation 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_inBufferwill ALWAYS be the same between calls. Technically, thesrcpointer must never be changed, and theposfield can only be updated by zstd. However, it's possible to increase thesizefield, 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_inBufferwithin 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_inBufferuntil 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_inBufferalways 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_inBufferin 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_inBufferto 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_outBufferwill 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_Sequencecontains block delimiters and last literals, which are defined as sequences withoffset == 0andmatchLength == 0. See the definition ofZSTD_Sequencefor 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.mdfor specifics regardingoffset/matchlengthrequirements) then the function will bail out and return an error.- See Also:
-
ZSTD_c_useBlockSplitter
public static final int ZSTD_c_useBlockSplitterControlled withZSTD_paramSwitch_eenum.- Default is
ps_auto. - Set to
ps_disableto never use block splitter. - Set to
ps_enableto 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_eenum.- Default is
ps_auto. - Set to
ps_disableto never use row-based matchfinder. - Set to
ps_enableto 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_efor 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_autois currently equivalent tops_disable, but in the future zstd may conditionally enable this feature via an auto-detection heuristic for cold CDicts. UseZSTD_ps_disableto 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_MAXor bounds lower than 1KB (will makecompressBoundinaccurate). 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 thecompressSequencesAPI 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_blockDelimitersis 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_einput 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_outBufferwill 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_outBufferMUST be large enough to fit the entire decompressed frame. This will be checked when the frame content size is known. The data in theZSTD_outBufferin 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_outBufferalways 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_outBufferin 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_outBufferto 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
dctxis allocated on the heap, then additional memory will be allocated to store references to multipleZSTD_DDict. That is, multiple calls ofDCtx_refDDictusing a givenZSTD_DCtx, rather than overwriting the previousDDictreference, will instead store all references. At decompression time, the appropriatedictIDis selected from the set ofDDictsbased on thedictIDin 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.freeDCtxalso 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_DDictthemselves.- 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_d_maxBlockSize
public static final int ZSTD_d_maxBlockSizeAllowed values are between 1KB andBLOCKSIZE_MAX(128KB). The default isZSTD_BLOCKSIZE_MAX, and setting to 0 will set to the default.Forces the decompressor to reject blocks whose content size is larger than the configured
maxBlockSize. WhenmaxBlockSizeis larger than thewindowSize, thewindowSizeis used instead. This saves memory on the decoder when you know all blocks are small.This option is typically used in conjunction with
c_maxBlockSize.WARNING: This causes the decoder to reject otherwise valid frames that have block sizes larger than the configured
maxBlockSize.- See Also:
-
ZSTD_lcm_auto
public static final int ZSTD_lcm_autoZSTD_literalCompressionMode_eEnum 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_eEnum 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_eEnum 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_eThis 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_enableorZSTD_ps_disableallow 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_eThis 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_enableorZSTD_ps_disableallow 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_eThis 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_enableorZSTD_ps_disableallow 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_eEnum values:
sf_noBlockDelimiters- Representation ofZSTD_Sequencehas no block delimiters, sequences only.sf_explicitBlockDelimiters- Representation ofZSTD_Sequencecontains explicit block delimiters.
- See Also:
-
ZSTD_sf_explicitBlockDelimiters
public static final int ZSTD_sf_explicitBlockDelimitersZSTD_sequenceFormat_eEnum values:
sf_noBlockDelimiters- Representation ofZSTD_Sequencehas no block delimiters, sequences only.sf_explicitBlockDelimiters- Representation ofZSTD_Sequencecontains 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 atsrcSizebytes 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_findDecompressedSizehandles 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 ifsrccontains 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,findDecompressedSizeandZSTD_decompressBoundreturn 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_ERRORif 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,
zfhPtris correctly filled, >0,srcSizeis too small, value is wantedsrcSizeamount, 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_zstd1f_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
decompressordecompressDCtx. 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
srcSizebytes
-
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
compressSequenceswithCCtxsetting ofc_blockDelimitersassf_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 withsrcbuffer, intodst.srccontains 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
cctxshould reference thedict. (see:CCtx_refCDict,CCtx_loadDictionary, etc.) The entire source is compressed into a single frame.The compression behavior changes based on
cctxparams. In particular:- If
ZSTD_c_blockDelimiters == ZSTD_sf_noBlockDelimiters, the array ofZSTD_Sequenceis 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_Sequenceis 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.mdfor 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_minMatchMUST be set as less than or equal to the smallest match generated by the match finder. It has a minimum value ofMINMATCH_MIN.c_compressionLevelaccordingly adjusts the strength of the entropy coder, as it would in typical compression.c_windowLogaffects 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::repis 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
repcodehistory.- 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 todstbuffer.Skippable frames begin with a 4-byte magic number. There are 16 possible choices of magic number, ranging from
MAGIC_SKIPPABLE_STARTtoZSTD_MAGIC_SKIPPABLE_START+15. As such, the parametermagicVariantcontrols 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
magicVariantis 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 todstbuffer.The parameter
magicVariantwill receive themagicVariantthat was supplied when the frame was written, i.e.magicNumber - ZSTD_MAGIC_SKIPPABLE_START. This can beNULLif 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 ofbufferstarts with a valid Frame Identifier for a skippable frame. -
ZSTD_estimateCCtxSize
public static long ZSTD_estimateCCtxSize(int maxCompressionLevel) Estimages memory usage of a futureCCtx, before its creation. This is useful in combination withinitStaticCCtx, which makes it possible to employ a static buffer forZSTD_CCtx*state.ZSTD_estimateCCtxSize()will provide a memory budget large enough to compress data of any size using one-shot compressioncompressCCtxorcompress2associated with any compression level up to max specified one. The estimate will assume the input may be arbitrarily large, which is the worst case.Note that the size estimation is specific for one-shot compression, it is not valid for streaming (see
ZSTD_estimateCStreamSize*()) nor other potential ways of using aZSTD_CCtx*state.When
srcSizecan be bound by a known and rather "small" value, this knowledge can be used to provide a tighter budget estimation because theZSTD_CCtx*state will need less memory for small inputs. This tighter estimation can be provided by employing 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 arbitrarysrcSizelimits.Note: only single-threaded compression is supported.
estimateCCtxSize_usingCCtxParamswill return an error code ifc_nbWorkersis ≥ 1. -
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 maxCompressionLevel) Provides a memory budget large enough for streaming compression using any compression level up to the max specified one.It will also consider
srcsize to be arbitrarily "large", which is a worst case scenario. IfsrcSizeis known to always be small,estimateCStreamSize_usingCParamscan provide a tighter estimation.ZSTD_estimateCStreamSize_usingCParams()can be used in tandem withgetCParamsto createcParamsfrom compressionLevel.estimateCStreamSize_usingCCtxParamscan be used in tandem withCCtxParams_setParameter. Only single-threaded compression is supported.This function will return an error code if
c_nbWorkersis ≥ 1.Note:
CStreamsize estimation is only correct for single-threaded compression.estimateCStreamSize_usingCCtxParamswill return an error code ifc_nbWorkersis ≥ 1.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.ZSTD_DStreammemory budget depends on frame's windowSize. This information can be passed manually, usingestimateDStreamSize, or deducted from a valid frameHeader, usingestimateDStreamSize_fromFrame. Any frame requesting a window size larger than max specified one will be rejected.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. -
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 maxWindowSize) -
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_byCopydlm_byRef
-
ZSTD_estimateDDictSize
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
-
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_byCopydlm_byRefdictContentType- one of:dct_autodct_rawContentdct_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_byCopydlm_byRefdictContentType- one of:dct_autodct_rawContentdct_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_byCopydlm_byRefdictContentType- one of:dct_autodct_rawContentdct_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- acceptsNULLpointer
-
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 (useNULLargument 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_byCopydlm_byRefdictContentType- one of:dct_autodct_rawContentdct_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_byCopydlm_byRefdictContentType- one of:dct_autodct_rawContentdct_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,
dictBuffermust 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_compressionParametersstructure 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_parametersobject instead of sub-componentZSTD_compressionParameters.All fields of
ZSTD_frameParametersare 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 givensrcSizeanddictSize. 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 withincparamsinto the workingcctx.Note: if modifying parameters during compression (MT mode only), note that changes to the
.windowLogparameter 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 withinfparamsinto 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 withinparamsinto 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
dictoutlives 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_byCopydlm_byRefdictContentType- 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
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_autodct_rawContentdct_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_paramsstructure. -
ZSTD_freeCCtxParams
public static long ZSTD_freeCCtxParams(long params) - Parameters:
params- acceptsNULLpointer
-
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 ofcctxParamsaccording 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 ofcctxParamsaccording 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_CCtxusingCCtx_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_paramsto 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, org.lwjgl.PointerBuffer dstPos, ByteBuffer src, org.lwjgl.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_continuee_flushe_end
-
nZSTD_isFrame
public static int nZSTD_isFrame(long buffer, long size) Unsafe version of:isFrame -
ZSTD_isFrame
Tells if the content ofbufferstarts with a valid Frame Identifier.Notes:
- Frame Identifier is 4 bytes. If
size < 4,@returnwill 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 thatdictBufferoutlivesDDict, 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 referencesdictcontent instead of copying it intodctx.This saves memory if
dictremains around. However, it's imperative thatdictremains 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_byCopydlm_byRefdictContentType- 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
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_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_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, org.lwjgl.PointerBuffer dstPos, ByteBuffer src, org.lwjgl.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
sequenceProducerStatemust 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
compress2andcompressStream2. 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
NULLfunction 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.
-
nZSTD_CCtxParams_registerSequenceProducer
public static void nZSTD_CCtxParams_registerSequenceProducer(long params, long sequenceProducerState, long sequenceProducer) Unsafe version of:CCtxParams_registerSequenceProducer -
ZSTD_CCtxParams_registerSequenceProducer
public static void ZSTD_CCtxParams_registerSequenceProducer(long params, long sequenceProducerState, @Nullable ZSTDSequenceProducerI sequenceProducer) Same asregisterSequenceProducer, but operates onZSTD_CCtx_params.This is used for accurate size estimation with
estimateCCtxSize_usingCCtxParams, which is needed when creating aZSTD_CCtxwithinitStaticCCtx.If you are using the external sequence producer API in a scenario where
ZSTD_initStaticCCtx()is required, then this function is for you. Otherwise, you probably don't need it.See
tests/zstreamtest.cfor example usage. -
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 originalsizeand 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 thewindowLogsmaller thanZSTD_BLOCKSIZELOG_MAXyou can just useZSTD_BLOCKSIZE_MAX.
-