Class ZstdX
- java.lang.Object
-
- org.lwjgl.util.zstd.ZstdX
-
public class ZstdX extends java.lang.Object
Native bindings to the experimental API of Zstandard (zstd).
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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_setParametersUsingCCtxParams(long cctx, long params)
Unsafe version of:CCtx_setParametersUsingCCtxParams
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_compress_advanced(long cctx, long dst, long dstCapacity, long src, long srcSize, long dict, long dictSize, long params)
Unsafe version of:compress_advanced
static long
nZSTD_compress_usingCDict_advanced(long cctx, long dst, long dstCapacity, long src, long srcSize, long cdict, long fParams)
Unsafe version of:compress_usingCDict_advanced
static long
nZSTD_compressBegin(long cctx, int compressionLevel)
static long
nZSTD_compressBegin_advanced(long cctx, long dict, long dictSize, long params, long pledgedSrcSize)
static long
nZSTD_compressBegin_usingCDict(long cctx, long cdict)
static long
nZSTD_compressBegin_usingCDict_advanced(long cctx, long cdict, long fParams, long pledgedSrcSize)
Unsafe version of:compressBegin_usingCDict_advanced
static long
nZSTD_compressBegin_usingDict(long cctx, long dict, long dictSize, int compressionLevel)
static long
nZSTD_compressBlock(long cctx, long dst, long dstCapacity, long src, long srcSize)
static long
nZSTD_compressContinue(long cctx, long dst, long dstCapacity, long src, long srcSize)
static long
nZSTD_compressEnd(long cctx, long dst, long dstCapacity, long src, long srcSize)
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_copyCCtx(long cctx, long preparedCCtx, long pledgedSrcSize)
Unsafe version of:copyCCtx
static void
nZSTD_copyDCtx(long dctx, long preparedDCtx)
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_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_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_setFormat(long dctx, int format)
Unsafe version of:DCtx_setFormat
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_decompressBlock(long dctx, long dst, long dstCapacity, long src, long srcSize)
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_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_freeCCtxParams(long params)
static long
nZSTD_getBlockSize(long cctx)
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 long
nZSTD_insertBlock(long dctx, long blockStart, long blockSize)
Unsafe version of:insertBlock
static int
nZSTD_isFrame(long buffer, long size)
Unsafe version of:isFrame
static int
nZSTD_nextInputType(long dctx)
static long
nZSTD_nextSrcSizeToDecompress(long dctx)
static long
nZSTD_toFlushNow(long cctx)
Unsafe version of:toFlushNow
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, java.nio.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, java.nio.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, java.nio.ByteBuffer dict)
Same asCCtx_loadDictionary
, but dictionary content is referenced, instead of being copied intoCCtx
.static long
ZSTD_CCtx_refPrefix_advanced(long cctx, java.nio.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_setParametersUsingCCtxParams(long cctx, long params)
Applies a set ofZSTD_CCtx_params
to the compression context.static long
ZSTD_CCtxParams_getParameter(long params, int param, java.nio.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
ZSTD_checkCParams(ZSTDCompressionParameters params)
Ensures param values remain within authorized range.static long
ZSTD_compress_advanced(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src, java.nio.ByteBuffer dict, ZSTDParameters params)
Same ascompress_usingDict
, with fine-tune control over compression parameters (by structure).static long
ZSTD_compress_usingCDict_advanced(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src, long cdict, ZSTDFrameParameters fParams)
Same ascompress_usingCDict
, with fine-tune control over frame parameters.static long
ZSTD_compressBegin(long cctx, int compressionLevel)
static long
ZSTD_compressBegin_advanced(long cctx, java.nio.ByteBuffer dict, ZSTDParameters params, long pledgedSrcSize)
static long
ZSTD_compressBegin_usingCDict(long cctx, long cdict)
static long
ZSTD_compressBegin_usingCDict_advanced(long cctx, long cdict, ZSTDFrameParameters fParams, long pledgedSrcSize)
static long
ZSTD_compressBegin_usingDict(long cctx, java.nio.ByteBuffer dict, int compressionLevel)
static long
ZSTD_compressBlock(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
static long
ZSTD_compressContinue(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
static long
ZSTD_compressEnd(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
static long
ZSTD_compressStream2_simpleArgs(long cctx, java.nio.ByteBuffer dst, org.lwjgl.PointerBuffer dstPos, java.nio.ByteBuffer src, org.lwjgl.PointerBuffer srcPos, int endOp)
Same ascompressStream2
, but using only integral types as arguments.static long
ZSTD_copyCCtx(long cctx, long preparedCCtx, long pledgedSrcSize)
static void
ZSTD_copyDCtx(long dctx, long preparedDCtx)
static long
ZSTD_createCCtx_advanced(ZSTDCustomMem customMem)
static long
ZSTD_createCCtxParams()
Creates aZSTD_CCtx_params
structure.static long
ZSTD_createCDict_advanced(java.nio.ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams, ZSTDCustomMem customMem)
static long
ZSTD_createCDict_byReference(java.nio.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(java.nio.ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCustomMem customMem)
static long
ZSTD_createDDict_byReference(java.nio.ByteBuffer dictBuffer)
Creates a digested dictionary, ready to start decompression operation without startup delay.static long
ZSTD_createDStream_advanced(ZSTDCustomMem customMem)
static long
ZSTD_DCtx_loadDictionary_advanced(long dctx, java.nio.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, java.nio.ByteBuffer dict)
static long
ZSTD_DCtx_refPrefix_advanced(long dctx, java.nio.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_setFormat(long dctx, int format)
Instructs the decoder context about what kind of data to decode next.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, java.nio.ByteBuffer dict)
static long
ZSTD_decompressBlock(long dctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
static long
ZSTD_decompressBound(java.nio.ByteBuffer src)
Note 1: an error can occur ifsrc
contains an invalid or incorrectly formatted frame.static long
ZSTD_decompressContinue(long dctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
static long
ZSTD_decompressStream_simpleArgs(long dctx, java.nio.ByteBuffer dst, org.lwjgl.PointerBuffer dstPos, java.nio.ByteBuffer src, org.lwjgl.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
ZSTD_estimateCCtxSize_usingCParams(ZSTDCompressionParameters cParams)
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
ZSTD_estimateCStreamSize_usingCParams(ZSTDCompressionParameters cParams)
static long
ZSTD_estimateDCtxSize()
static long
ZSTD_estimateDDictSize(long dictSize, int dictLoadMethod)
static long
ZSTD_estimateDStreamSize(long windowSize)
static long
ZSTD_estimateDStreamSize_fromFrame(java.nio.ByteBuffer src)
static long
ZSTD_findDecompressedSize(java.nio.ByteBuffer src)
Note 1: decompressed size is an optional field, that may not be present, especially in streaming mode.static long
ZSTD_frameHeaderSize(java.nio.ByteBuffer src)
static long
ZSTD_freeCCtxParams(long params)
static long
ZSTD_getBlockSize(long cctx)
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, java.nio.ByteBuffer src)
Decode Frame Header, or requires largersrcSize
.static long
ZSTD_getFrameHeader_advanced(ZSTDFrameHeader zfhPtr, java.nio.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(java.nio.ByteBuffer workspace)
static long
ZSTD_initStaticCDict(java.nio.ByteBuffer workspace, java.nio.ByteBuffer dict, int dictLoadMethod, int dictContentType, ZSTDCompressionParameters cParams)
static long
ZSTD_initStaticCStream(java.nio.ByteBuffer workspace)
static long
ZSTD_initStaticDCtx(java.nio.ByteBuffer workspace)
static long
ZSTD_initStaticDDict(java.nio.ByteBuffer workspace, java.nio.ByteBuffer dict, int dictLoadMethod, int dictContentType)
static long
ZSTD_initStaticDStream(java.nio.ByteBuffer workspace)
static long
ZSTD_insertBlock(long dctx, java.nio.ByteBuffer blockStart)
Insert uncompressed block intodctx
history.static boolean
ZSTD_isFrame(java.nio.ByteBuffer buffer)
Tells if the content ofbuffer
starts with a valid Frame Identifier.static int
ZSTD_nextInputType(long dctx)
static long
ZSTD_nextSrcSizeToDecompress(long dctx)
static long
ZSTD_toFlushNow(long cctx)
Tells how many bytes are ready to be flushed immediately.
-
-
-
Field Detail
-
ZSTD_dct_auto, ZSTD_dct_rawContent, ZSTD_dct_fullDict
ZSTD_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
-
ZSTD_dlm_byCopy, ZSTD_dlm_byRef
ZSTD_dictLoadMethod_e
Enum values:
dlm_byCopy
- Copy dictionary content internallydlm_byRef
- Reference dictionary content -- the dictionary buffer must outlive its users.
-
ZSTD_f_zstd1, ZSTD_f_zstd1_magicless
ZSTD_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.
-
ZSTD_dictDefaultAttach, ZSTD_dictForceAttach, ZSTD_dictForceCopy
ZSTD_dictAttachPref_e
Enum values:
dictDefaultAttach
- Use the default heuristic.dictForceAttach
- Never copy the dictionary.dictForceCopy
- Always copy the dictionary.
-
ZSTDnit_frameHeader, ZSTDnit_blockHeader, ZSTDnit_block, ZSTDnit_lastBlock, ZSTDnit_checksum, ZSTDnit_skippableFrame
ZSTD_nextInputType_e
Enum values:
-
ZSTD_FRAMEHEADERSIZE_PREFIX
- See Also:
- Constant Field Values
-
ZSTD_FRAMEHEADERSIZE_MIN
- See Also:
- Constant Field Values
-
ZSTD_FRAMEHEADERSIZE_MAX
- See Also:
- Constant Field Values
-
ZSTD_SKIPPABLEHEADERSIZE
- See Also:
- Constant Field Values
-
ZSTD_WINDOWLOG_MAX_32
- See Also:
- Constant Field Values
-
ZSTD_WINDOWLOG_MAX_64
- See Also:
- Constant Field Values
-
ZSTD_WINDOWLOG_MIN
public static final int ZSTD_WINDOWLOG_MIN
-
ZSTD_HASHLOG_MIN
public static final int ZSTD_HASHLOG_MIN
-
ZSTD_CHAINLOG_MAX_32
- See Also:
- Constant Field Values
-
ZSTD_CHAINLOG_MAX_64
- See Also:
- Constant Field Values
-
ZSTD_CHAINLOG_MIN
public static final int ZSTD_CHAINLOG_MIN
-
ZSTD_SEARCHLOG_MIN
- See Also:
- Constant Field Values
-
ZSTD_MINMATCH_MAX
- See Also:
- Constant Field Values
-
ZSTD_MINMATCH_MIN
- See Also:
- Constant Field Values
-
ZSTD_TARGETLENGTH_MAX
- See Also:
- Constant Field Values
-
ZSTD_TARGETLENGTH_MIN
- See Also:
- Constant Field Values
-
ZSTD_STRATEGY_MIN
- See Also:
- Constant Field Values
-
ZSTD_STRATEGY_MAX
- See Also:
- Constant Field Values
-
ZSTD_OVERLAPLOG_MIN
- See Also:
- Constant Field Values
-
ZSTD_OVERLAPLOG_MAX
- See Also:
- Constant Field Values
-
ZSTD_WINDOWLOG_LIMIT_DEFAULT
- See Also:
- Constant Field Values
-
ZSTD_LDM_HASHLOG_MIN
- See Also:
- Constant Field Values
-
ZSTD_LDM_MINMATCH_MIN
public static final int ZSTD_LDM_MINMATCH_MIN
-
ZSTD_LDM_MINMATCH_MAX
- See Also:
- Constant Field Values
-
ZSTD_LDM_BUCKETSIZELOG_MIN
- See Also:
- Constant Field Values
-
ZSTD_LDM_BUCKETSIZELOG_MAX
- See Also:
- Constant Field Values
-
ZSTD_LDM_HASHRATELOG_MIN
- See Also:
- Constant Field Values
-
ZSTD_TARGETCBLOCKSIZE_MIN
- See Also:
- Constant Field Values
-
ZSTD_TARGETCBLOCKSIZE_MAX
- See Also:
- Constant Field Values
-
ZSTD_HASHLOG3_MAX
- See Also:
- Constant Field Values
-
ZSTD_c_rsyncable
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. 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.
-
ZSTD_c_format
Select a compression format.The value must be of type
ZSTD_format_e
.
-
ZSTD_c_forceMaxWindow
Force back-reference distances to remain <windowSize
, even when referencing into Dictionary content. (default:0)
-
ZSTD_c_forceAttachDict
Controls whether the contents of aCDict
are used in place, or copied into the working context.Accepts values from the
ZSTD_dictAttachPref_e
enum.
-
ZSTD_c_literalCompressionMode
Controls how the literals are compressed (default isauto
).The value must be of type
ZSTD_literalCompressionMode_e
.
-
ZSTD_c_targetCBlockSize
Tries to fit compressed block size to be aroundtargetCBlockSize
.No target when
targetCBlockSize == 0
. There is no guarantee on compressed block size. (default:0)
-
ZSTD_d_format
- See Also:
- Constant Field Values
-
ZSTD_lcm_auto, ZSTD_lcm_huffman, ZSTD_lcm_uncompressed
ZSTD_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.
-
-
Method Detail
-
nZSTD_findDecompressedSize
public static long nZSTD_findDecompressedSize(long src, long srcSize)
Unsafe version of:findDecompressedSize
- Parameters:
srcSize
- must be the exact size of this series (i.e. there should be a frame boundary exactly atsrcSize
bytes aftersrc + srcSize
)
-
ZSTD_findDecompressedSize
public static long ZSTD_findDecompressedSize(java.nio.ByteBuffer src)
Note 1: decompressed size is an optional field, that may not be present, especially in streaming mode. 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
public static long ZSTD_decompressBound(java.nio.ByteBuffer src)
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 occured
-
nZSTD_frameHeaderSize
public static long nZSTD_frameHeaderSize(long src, long srcSize)
Unsafe version of:frameHeaderSize
- Parameters:
srcSize
- must be ≥FRAMEHEADERSIZE_PREFIX
-
ZSTD_frameHeaderSize
public static long ZSTD_frameHeaderSize(java.nio.ByteBuffer src)
- Returns:
- : size of the Frame Header, or an error code (if srcSize is too small)
-
ZSTD_estimateCCtxSize
public static long ZSTD_estimateCCtxSize(int compressionLevel)
Estimages memory usage of a futureCCtx
, before its creation.ZSTD_estimateCCtxSize()
will provide a budget large enough for any compression level up to selected one. It will also considersrc
size to be arbitrarily "large", which is worst case. IfsrcSize
is known to always be small,estimateCCtxSize_usingCParams
can provide a tighter estimation.estimateCCtxSize_usingCParams
can be used in tandem withgetCParams
to createcParams
from compressionLevel.estimateCCtxSize_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:
CCtx
size estimation is only correct for single-threaded compression.
-
nZSTD_estimateCCtxSize_usingCParams
public static long nZSTD_estimateCCtxSize_usingCParams(long cParams)
-
ZSTD_estimateCCtxSize_usingCParams
public static long ZSTD_estimateCCtxSize_usingCParams(ZSTDCompressionParameters cParams)
-
nZSTD_estimateCCtxSize_usingCCtxParams
public static long nZSTD_estimateCCtxSize_usingCCtxParams(long params)
-
ZSTD_estimateCCtxSize_usingCCtxParams
public static long ZSTD_estimateCCtxSize_usingCCtxParams(long params)
-
ZSTD_estimateDCtxSize
public static long ZSTD_estimateDCtxSize()
-
ZSTD_estimateCStreamSize
public static long ZSTD_estimateCStreamSize(int compressionLevel)
Provides a budget large enough for any compression level up to selected one.It will also consider
src
size to be arbitrarily "large", which is worst case. 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
.
-
nZSTD_estimateCStreamSize_usingCParams
public static long nZSTD_estimateCStreamSize_usingCParams(long cParams)
-
ZSTD_estimateCStreamSize_usingCParams
public static long ZSTD_estimateCStreamSize_usingCParams(ZSTDCompressionParameters cParams)
-
nZSTD_estimateCStreamSize_usingCCtxParams
public static long nZSTD_estimateCStreamSize_usingCCtxParams(long params)
-
ZSTD_estimateCStreamSize_usingCCtxParams
public static long ZSTD_estimateCStreamSize_usingCCtxParams(long params)
-
ZSTD_estimateDStreamSize
public static long ZSTD_estimateDStreamSize(long windowSize)
-
nZSTD_estimateDStreamSize_fromFrame
public static long nZSTD_estimateDStreamSize_fromFrame(long src, long srcSize)
-
ZSTD_estimateDStreamSize_fromFrame
public static long ZSTD_estimateDStreamSize_fromFrame(java.nio.ByteBuffer src)
-
ZSTD_estimateCDictSize
public static long ZSTD_estimateCDictSize(long dictSize, int compressionLevel)
-
nZSTD_estimateCDictSize_advanced
public static long nZSTD_estimateCDictSize_advanced(long dictSize, long cParams, int dictLoadMethod)
Unsafe version of:estimateCDictSize_advanced
-
ZSTD_estimateCDictSize_advanced, ZSTD_estimateDDictSize
public static long ZSTD_estimateCDictSize_advanced(long dictSize, ZSTDCompressionParameters cParams, int dictLoadMethod) public static long ZSTD_estimateDDictSize(long dictSize, int dictLoadMethod)
- Parameters:
dictLoadMethod
- one of:dlm_byCopy
dlm_byRef
-
nZSTD_initStaticCCtx
public static long nZSTD_initStaticCCtx(long workspace, long workspaceSize)
-
ZSTD_initStaticCCtx
public static long ZSTD_initStaticCCtx(java.nio.ByteBuffer workspace)
-
nZSTD_initStaticCStream
public static long nZSTD_initStaticCStream(long workspace, long workspaceSize)
-
ZSTD_initStaticCStream
public static long ZSTD_initStaticCStream(java.nio.ByteBuffer workspace)
-
nZSTD_initStaticDCtx
public static long nZSTD_initStaticDCtx(long workspace, long workspaceSize)
-
ZSTD_initStaticDCtx
public static long ZSTD_initStaticDCtx(java.nio.ByteBuffer workspace)
-
nZSTD_initStaticDStream
public static long nZSTD_initStaticDStream(long workspace, long workspaceSize)
-
ZSTD_initStaticDStream
public static long ZSTD_initStaticDStream(java.nio.ByteBuffer workspace)
-
nZSTD_initStaticCDict
public static long nZSTD_initStaticCDict(long workspace, long workspaceSize, long dict, long dictSize, int dictLoadMethod, int dictContentType, long cParams)
Unsafe version of:initStaticCDict
-
ZSTD_initStaticCDict
public static long ZSTD_initStaticCDict(java.nio.ByteBuffer workspace, java.nio.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(java.nio.ByteBuffer workspace, java.nio.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
public static long ZSTD_createCCtx_advanced(ZSTDCustomMem customMem)
-
nZSTD_createCStream_advanced
public static long nZSTD_createCStream_advanced(long customMem)
-
ZSTD_createCStream_advanced
public static long ZSTD_createCStream_advanced(ZSTDCustomMem customMem)
-
nZSTD_createDCtx_advanced
public static long nZSTD_createDCtx_advanced(long customMem)
-
ZSTD_createDCtx_advanced
public static long ZSTD_createDCtx_advanced(ZSTDCustomMem customMem)
-
nZSTD_createDStream_advanced
public static long nZSTD_createDStream_advanced(long customMem)
-
ZSTD_createDStream_advanced
public static long ZSTD_createDStream_advanced(ZSTDCustomMem customMem)
-
nZSTD_createCDict_advanced
public static long nZSTD_createCDict_advanced(long dict, long dictSize, int dictLoadMethod, int dictContentType, long cParams, long customMem)
Unsafe version of:createCDict_advanced
-
ZSTD_createCDict_advanced
public static long ZSTD_createCDict_advanced(java.nio.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
-
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(java.nio.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
public static long ZSTD_createCDict_byReference(java.nio.ByteBuffer dictBuffer, int compressionLevel)
Creates a digested dictionary for compression Dictionary content is just referenced, not duplicated.As a consequence,
dictBuffer
must outliveCDict
, and its content must remain unmodified throughout the lifetime ofCDict
.
-
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
public static long ZSTD_checkCParams(ZSTDCompressionParameters params)
Ensures param values remain within authorized range.- Returns:
- 0 on success, or an error code (can be checked with
isError
)
-
nZSTD_adjustCParams
public static void nZSTD_adjustCParams(long cPar, long srcSize, long dictSize, long __result)
Unsafe version of:adjustCParams
-
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_compress_advanced
public static long nZSTD_compress_advanced(long cctx, long dst, long dstCapacity, long src, long srcSize, long dict, long dictSize, long params)
Unsafe version of:compress_advanced
-
ZSTD_compress_advanced
public static long ZSTD_compress_advanced(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src, java.nio.ByteBuffer dict, ZSTDParameters params)
Same ascompress_usingDict
, with fine-tune control over compression parameters (by structure).
-
nZSTD_compress_usingCDict_advanced
public static long nZSTD_compress_usingCDict_advanced(long cctx, long dst, long dstCapacity, long src, long srcSize, long cdict, long fParams)
Unsafe version of:compress_usingCDict_advanced
-
ZSTD_compress_usingCDict_advanced
public static long ZSTD_compress_usingCDict_advanced(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src, long cdict, ZSTDFrameParameters fParams)
Same ascompress_usingCDict
, with fine-tune control over frame parameters.
-
nZSTD_CCtx_loadDictionary_byReference
public static long nZSTD_CCtx_loadDictionary_byReference(long cctx, long dict, long dictSize)
Unsafe version of:CCtx_loadDictionary_byReference
-
ZSTD_CCtx_loadDictionary_byReference
public static long ZSTD_CCtx_loadDictionary_byReference(long cctx, java.nio.ByteBuffer dict)
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, java.nio.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
public static long ZSTD_CCtx_refPrefix_advanced(long cctx, java.nio.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 ?).- 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
public static long ZSTD_CCtx_getParameter(long cctx, int param, java.nio.IntBuffer value)
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.
-
nZSTD_freeCCtxParams
public static long nZSTD_freeCCtxParams(long params)
-
ZSTD_freeCCtxParams
public static long ZSTD_freeCCtxParams(long params)
-
nZSTD_CCtxParams_reset
public static long nZSTD_CCtxParams_reset(long params)
Unsafe version of:CCtxParams_reset
-
ZSTD_CCtxParams_reset
public static long ZSTD_CCtxParams_reset(long params)
Resets params to default values.
-
nZSTD_CCtxParams_init
public static long nZSTD_CCtxParams_init(long cctxParams, int compressionLevel)
Unsafe version of:CCtxParams_init
-
ZSTD_CCtxParams_init
public static long ZSTD_CCtxParams_init(long cctxParams, int compressionLevel)
Initializes the compression parameters 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
public static long ZSTD_CCtxParams_init_advanced(long cctxParams, ZSTDParameters params)
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:
- 0, or an error code (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
public static long ZSTD_CCtxParams_getParameter(long params, int param, java.nio.IntBuffer value)
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, java.nio.ByteBuffer dst, org.lwjgl.PointerBuffer dstPos, java.nio.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_continue
e_flush
e_end
-
nZSTD_isFrame
public static int nZSTD_isFrame(long buffer, long size)
Unsafe version of:isFrame
-
ZSTD_isFrame
public static boolean ZSTD_isFrame(java.nio.ByteBuffer buffer)
Tells if the content 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
public static long ZSTD_createDDict_byReference(java.nio.ByteBuffer dictBuffer)
Creates a digested dictionary, ready to start decompression operation without startup delay.Dictionary content is referenced, and therefore stays in
dictBuffer
. It is important 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
public static long ZSTD_DCtx_loadDictionary_byReference(long dctx, java.nio.ByteBuffer dict)
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, java.nio.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
public static long ZSTD_DCtx_refPrefix_advanced(long dctx, java.nio.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 ?).- 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_setFormat
public static long nZSTD_DCtx_setFormat(long dctx, int format)
Unsafe version of:DCtx_setFormat
-
ZSTD_DCtx_setFormat
public static long ZSTD_DCtx_setFormat(long dctx, int format)
Instructs the decoder context about what kind of data to decode next.This instruction is mandatory to decode data without a fully-formed header, such
f_zstd1_magicless
for example.- Parameters:
format
- one of:f_zstd1
f_zstd1_magicless
- Returns:
- 0, or an error code (which can be tested using
isError
)
-
nZSTD_decompressStream_simpleArgs
public static long nZSTD_decompressStream_simpleArgs(long dctx, long dst, long dstCapacity, long dstPos, long src, long srcSize, long srcPos)
Unsafe version of:decompressStream_simpleArgs
-
ZSTD_decompressStream_simpleArgs
public static long ZSTD_decompressStream_simpleArgs(long dctx, java.nio.ByteBuffer dst, org.lwjgl.PointerBuffer dstPos, java.nio.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_compressBegin
public static long nZSTD_compressBegin(long cctx, int compressionLevel)
-
ZSTD_compressBegin
public static long ZSTD_compressBegin(long cctx, int compressionLevel)
-
nZSTD_compressBegin_usingDict
public static long nZSTD_compressBegin_usingDict(long cctx, long dict, long dictSize, int compressionLevel)
-
ZSTD_compressBegin_usingDict
public static long ZSTD_compressBegin_usingDict(long cctx, java.nio.ByteBuffer dict, int compressionLevel)
-
nZSTD_compressBegin_advanced
public static long nZSTD_compressBegin_advanced(long cctx, long dict, long dictSize, long params, long pledgedSrcSize)
-
ZSTD_compressBegin_advanced
public static long ZSTD_compressBegin_advanced(long cctx, java.nio.ByteBuffer dict, ZSTDParameters params, long pledgedSrcSize)
-
nZSTD_compressBegin_usingCDict
public static long nZSTD_compressBegin_usingCDict(long cctx, long cdict)
-
ZSTD_compressBegin_usingCDict
public static long ZSTD_compressBegin_usingCDict(long cctx, long cdict)
-
nZSTD_compressBegin_usingCDict_advanced
public static long nZSTD_compressBegin_usingCDict_advanced(long cctx, long cdict, long fParams, long pledgedSrcSize)
Unsafe version of:compressBegin_usingCDict_advanced
-
ZSTD_compressBegin_usingCDict_advanced
public static long ZSTD_compressBegin_usingCDict_advanced(long cctx, long cdict, ZSTDFrameParameters fParams, long pledgedSrcSize)
- Parameters:
pledgedSrcSize
- if not known, useCONTENTSIZE_UNKNOWN
-
nZSTD_copyCCtx
public static long nZSTD_copyCCtx(long cctx, long preparedCCtx, long pledgedSrcSize)
Unsafe version of:copyCCtx
-
ZSTD_copyCCtx
public static long ZSTD_copyCCtx(long cctx, long preparedCCtx, long pledgedSrcSize)
- Parameters:
pledgedSrcSize
- if not known, useCONTENTSIZE_UNKNOWN
-
nZSTD_compressContinue
public static long nZSTD_compressContinue(long cctx, long dst, long dstCapacity, long src, long srcSize)
-
ZSTD_compressContinue
public static long ZSTD_compressContinue(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
-
nZSTD_compressEnd
public static long nZSTD_compressEnd(long cctx, long dst, long dstCapacity, long src, long srcSize)
-
ZSTD_compressEnd
public static long ZSTD_compressEnd(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
-
nZSTD_getFrameHeader
public static long nZSTD_getFrameHeader(long zfhPtr, long src, long srcSize)
Unsafe version of:getFrameHeader
-
ZSTD_getFrameHeader
public static long ZSTD_getFrameHeader(ZSTDFrameHeader zfhPtr, java.nio.ByteBuffer src)
Decode Frame Header, or requires 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
public static long ZSTD_getFrameHeader_advanced(ZSTDFrameHeader zfhPtr, java.nio.ByteBuffer src, int format)
Same asgetFrameHeader
, with added capability to select a format (likef_zstd1_magicless
).- Parameters:
format
- one of:f_zstd1
f_zstd1_magicless
-
ZSTD_decodingBufferSize_min
public static long ZSTD_decodingBufferSize_min(long windowSize, long frameContentSize)
-
nZSTD_decompressBegin
public static long nZSTD_decompressBegin(long dctx)
-
ZSTD_decompressBegin
public static long ZSTD_decompressBegin(long dctx)
-
nZSTD_decompressBegin_usingDict
public static long nZSTD_decompressBegin_usingDict(long dctx, long dict, long dictSize)
-
ZSTD_decompressBegin_usingDict
public static long ZSTD_decompressBegin_usingDict(long dctx, java.nio.ByteBuffer dict)
-
nZSTD_decompressBegin_usingDDict
public static long nZSTD_decompressBegin_usingDDict(long dctx, long ddict)
-
ZSTD_decompressBegin_usingDDict
public static long ZSTD_decompressBegin_usingDDict(long dctx, long ddict)
-
nZSTD_nextSrcSizeToDecompress
public static long nZSTD_nextSrcSizeToDecompress(long dctx)
-
ZSTD_nextSrcSizeToDecompress
public static long ZSTD_nextSrcSizeToDecompress(long dctx)
-
nZSTD_decompressContinue
public static long nZSTD_decompressContinue(long dctx, long dst, long dstCapacity, long src, long srcSize)
-
ZSTD_decompressContinue
public static long ZSTD_decompressContinue(long dctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
-
nZSTD_copyDCtx
public static void nZSTD_copyDCtx(long dctx, long preparedDCtx)
-
ZSTD_copyDCtx
public static void ZSTD_copyDCtx(long dctx, long preparedDCtx)
-
nZSTD_nextInputType
public static int nZSTD_nextInputType(long dctx)
-
ZSTD_nextInputType
public static int ZSTD_nextInputType(long dctx)
-
nZSTD_getBlockSize
public static long nZSTD_getBlockSize(long cctx)
-
ZSTD_getBlockSize
public static long ZSTD_getBlockSize(long cctx)
-
nZSTD_compressBlock
public static long nZSTD_compressBlock(long cctx, long dst, long dstCapacity, long src, long srcSize)
-
ZSTD_compressBlock
public static long ZSTD_compressBlock(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
-
nZSTD_decompressBlock
public static long nZSTD_decompressBlock(long dctx, long dst, long dstCapacity, long src, long srcSize)
-
ZSTD_decompressBlock
public static long ZSTD_decompressBlock(long dctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src)
-
nZSTD_insertBlock
public static long nZSTD_insertBlock(long dctx, long blockStart, long blockSize)
Unsafe version of:insertBlock
-
ZSTD_insertBlock
public static long ZSTD_insertBlock(long dctx, java.nio.ByteBuffer blockStart)
Insert uncompressed block intodctx
history. Useful for multi-blocks decompression.
-
-