Class LZ4Frame
- java.lang.Object
-
- org.lwjgl.util.lz4.LZ4Frame
-
public class LZ4Frame extends java.lang.Object
Native bindings to the frame API of LZ4.LZ4F is a stand-alone API to create LZ4-compressed frames conformant with specification v1.6.1. It also offers streaming capabilities.
lz4.h
is not required when usinglz4frame.h
, except to get constant such asVERSION_NUMBER
.
-
-
Field Summary
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
LZ4F_compressBegin(long cctx, java.nio.ByteBuffer dstBuffer, LZ4FPreferences prefsPtr)
Will write the frame header intodstBuffer
.static long
LZ4F_compressBegin_usingCDict(long cctx, java.nio.ByteBuffer dstBuffer, long cdict, LZ4FPreferences prefsPtr)
Inits streaming dictionary compression, and writes the frame header intodstBuffer
.static long
LZ4F_compressBound(long srcSize, LZ4FPreferences prefsPtr)
Provides minimumdstCapacity
required to guarantee compression success given asrcSize
and preferences, covering worst case scenario.static long
LZ4F_compressEnd(long cctx, java.nio.ByteBuffer dstBuffer, LZ4FCompressOptions cOptPtr)
To properly finish an LZ4 frame, invokecompressEnd
.static long
LZ4F_compressFrame(java.nio.ByteBuffer dstBuffer, java.nio.ByteBuffer srcBuffer, LZ4FPreferences preferencesPtr)
Compress an entiresrcBuffer
into a valid LZ4 frame.static long
LZ4F_compressFrame_usingCDict(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src, long cdict, LZ4FPreferences preferencesPtr)
Compress an entiresrcBuffer
into a valid LZ4 frame using a digested Dictionary.static long
LZ4F_compressFrameBound(long srcSize, LZ4FPreferences preferencesPtr)
Returns the maximum possible size of a frame compressed withcompressFrame
givensrcSize
content and preferences.static int
LZ4F_compressionLevel_max()
static long
LZ4F_compressUpdate(long cctx, java.nio.ByteBuffer dstBuffer, java.nio.ByteBuffer srcBuffer, LZ4FCompressOptions cOptPtr)
LZ4F_compressUpdate()
can be called repetitively to compress as much data as necessary.static long
LZ4F_createCDict(java.nio.ByteBuffer dictBuffer)
When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once.static long
LZ4F_createCompressionContext(org.lwjgl.PointerBuffer cctxPtr, int version)
The first thing to do is to create acompressionContext
object, which will be used in all compression operations.static long
LZ4F_createDecompressionContext(org.lwjgl.PointerBuffer dctxPtr, int version)
Create anLZ4F_dctx
object, to track all decompression operations.static long
LZ4F_decompress(long dctx, java.nio.ByteBuffer dstBuffer, org.lwjgl.PointerBuffer dstSizePtr, java.nio.ByteBuffer srcBuffer, org.lwjgl.PointerBuffer srcSizePtr, LZ4FDecompressOptions dOptPtr)
Call this function repetitively to regenerate compressed data fromsrcBuffer
.static long
LZ4F_decompress_usingDict(long dctxPtr, java.nio.ByteBuffer dstBuffer, org.lwjgl.PointerBuffer dstSizePtr, java.nio.ByteBuffer srcBuffer, org.lwjgl.PointerBuffer srcSizePtr, java.nio.ByteBuffer dict, LZ4FDecompressOptions decompressOptionsPtr)
Same asdecompress
, using a predefined dictionary.static long
LZ4F_flush(long cctx, java.nio.ByteBuffer dstBuffer, LZ4FCompressOptions cOptPtr)
When data must be generated and sent immediately, without waiting for a block to be completely filled, it's possible to callflush
.static void
LZ4F_freeCDict(long CDict)
static long
LZ4F_freeCompressionContext(long cctx)
static long
LZ4F_freeDecompressionContext(long dctx)
Frees anLZ4F_dctx
object.static int
LZ4F_getErrorCode(long functionResult)
static java.lang.String
LZ4F_getErrorName(long code)
Return error code string; for debugging.static long
LZ4F_getFrameInfo(long dctx, LZ4FFrameInfo frameInfoPtr, java.nio.ByteBuffer srcBuffer, org.lwjgl.PointerBuffer srcSizePtr)
This function extracts frame parameters (maxblockSize
,dictID
, etc.).static int
LZ4F_getVersion()
static boolean
LZ4F_isError(long code)
Tells when a function result is an error code.static void
LZ4F_resetDecompressionContext(long dctx)
In case of an error, the context is left in "undefined" state.static long
nLZ4F_compressBegin(long cctx, long dstBuffer, long dstCapacity, long prefsPtr)
Unsafe version of:compressBegin
static long
nLZ4F_compressBegin_usingCDict(long cctx, long dstBuffer, long dstCapacity, long cdict, long prefsPtr)
Unsafe version of:compressBegin_usingCDict
static long
nLZ4F_compressBound(long srcSize, long prefsPtr)
Unsafe version of:compressBound
static long
nLZ4F_compressEnd(long cctx, long dstBuffer, long dstCapacity, long cOptPtr)
Unsafe version of:compressEnd
static long
nLZ4F_compressFrame(long dstBuffer, long dstCapacity, long srcBuffer, long srcSize, long preferencesPtr)
Unsafe version of:compressFrame
static long
nLZ4F_compressFrame_usingCDict(long cctx, long dst, long dstCapacity, long src, long srcSize, long cdict, long preferencesPtr)
Unsafe version of:compressFrame_usingCDict
static long
nLZ4F_compressFrameBound(long srcSize, long preferencesPtr)
Unsafe version of:compressFrameBound
static long
nLZ4F_compressUpdate(long cctx, long dstBuffer, long dstCapacity, long srcBuffer, long srcSize, long cOptPtr)
Unsafe version of:compressUpdate
static long
nLZ4F_createCDict(long dictBuffer, long dictSize)
Unsafe version of:createCDict
static long
nLZ4F_createCompressionContext(long cctxPtr, int version)
Unsafe version of:createCompressionContext
static long
nLZ4F_createDecompressionContext(long dctxPtr, int version)
Unsafe version of:createDecompressionContext
static long
nLZ4F_decompress(long dctx, long dstBuffer, long dstSizePtr, long srcBuffer, long srcSizePtr, long dOptPtr)
Unsafe version of:decompress
static long
nLZ4F_decompress_usingDict(long dctxPtr, long dstBuffer, long dstSizePtr, long srcBuffer, long srcSizePtr, long dict, long dictSize, long decompressOptionsPtr)
Unsafe version of:decompress_usingDict
static long
nLZ4F_flush(long cctx, long dstBuffer, long dstCapacity, long cOptPtr)
Unsafe version of:flush
static void
nLZ4F_freeCDict(long CDict)
static long
nLZ4F_freeCompressionContext(long cctx)
static long
nLZ4F_freeDecompressionContext(long dctx)
Unsafe version of:freeDecompressionContext
static long
nLZ4F_getErrorName(long code)
Unsafe version of:getErrorName
static long
nLZ4F_getFrameInfo(long dctx, long frameInfoPtr, long srcBuffer, long srcSizePtr)
Unsafe version of:getFrameInfo
static int
nLZ4F_isError(long code)
Unsafe version of:isError
static void
nLZ4F_resetDecompressionContext(long dctx)
Unsafe version of:resetDecompressionContext
-
-
-
Field Detail
-
LZ4F_VERSION
Version number.This number can be used to check for an incompatible API breaking change.
-
LZ4F_HEADER_SIZE_MIN
Minimum header size.
-
LZ4F_HEADER_SIZE_MAX
Maximum header size.
-
LZ4F_BLOCK_HEADER_SIZE
Size in bytes of a block header in little-endian format. Highest bit indicates if block data is uncompressed.
-
LZ4F_BLOCK_CHECKSUM_SIZE
Size in bytes of a block checksum footer in little-endian format.
-
LZ4F_CONTENT_CHECKSUM_SIZE
Size in bytes of the content checksum.
-
LZ4F_blockLinked, LZ4F_blockIndependent
LZ4F_blockMode_t
Linked blocks sharply reduce inefficiencies when using small blocks, they compress better. However, some LZ4 decoders are only compatible with independent blocks
Enum values:
-
LZ4F_OK_NoError, LZ4F_ERROR_GENERIC, LZ4F_ERROR_maxBlockSize_invalid, LZ4F_ERROR_blockMode_invalid, LZ4F_ERROR_contentChecksumFlag_invalid, LZ4F_ERROR_compressionLevel_invalid, LZ4F_ERROR_headerVersion_wrong, LZ4F_ERROR_blockChecksum_invalid, LZ4F_ERROR_reservedFlag_set, LZ4F_ERROR_allocation_failed, LZ4F_ERROR_srcSize_tooLarge, LZ4F_ERROR_dstMaxSize_tooSmall, LZ4F_ERROR_frameHeader_incomplete, LZ4F_ERROR_frameType_unknown, LZ4F_ERROR_frameSize_wrong, LZ4F_ERROR_srcPtr_wrong, LZ4F_ERROR_decompressionFailed, LZ4F_ERROR_headerChecksum_invalid, LZ4F_ERROR_contentChecksum_invalid, LZ4F_ERROR_frameDecoding_alreadyStarted, LZ4F_ERROR_maxCode
Error code.Enum values:
OK_NoError
ERROR_GENERIC
ERROR_maxBlockSize_invalid
ERROR_blockMode_invalid
ERROR_contentChecksumFlag_invalid
ERROR_compressionLevel_invalid
ERROR_headerVersion_wrong
ERROR_blockChecksum_invalid
ERROR_reservedFlag_set
ERROR_allocation_failed
ERROR_srcSize_tooLarge
ERROR_dstMaxSize_tooSmall
ERROR_frameHeader_incomplete
ERROR_frameType_unknown
ERROR_frameSize_wrong
ERROR_srcPtr_wrong
ERROR_decompressionFailed
ERROR_headerChecksum_invalid
ERROR_contentChecksum_invalid
ERROR_frameDecoding_alreadyStarted
ERROR_maxCode
-
-
Method Detail
-
nLZ4F_isError
public static int nLZ4F_isError(long code)
Unsafe version of:isError
-
LZ4F_isError
public static boolean LZ4F_isError(long code)
Tells when a function result is an error code.
-
nLZ4F_getErrorName
public static long nLZ4F_getErrorName(long code)
Unsafe version of:getErrorName
-
LZ4F_getErrorName
@Nullable public static java.lang.String LZ4F_getErrorName(long code)
Return error code string; for debugging.
-
LZ4F_compressionLevel_max
public static int LZ4F_compressionLevel_max()
-
nLZ4F_compressFrameBound
public static long nLZ4F_compressFrameBound(long srcSize, long preferencesPtr)
Unsafe version of:compressFrameBound
-
LZ4F_compressFrameBound
public static long LZ4F_compressFrameBound(long srcSize, @Nullable LZ4FPreferences preferencesPtr)
Returns the maximum possible size of a frame compressed withcompressFrame
givensrcSize
content and preferences.Returns the maximum possible compressed size with
compressFrame
givensrcSize
and preferences.preferencesPtr
is optional. It can be replaced byNULL
, in which case, the function will assume default preferences.Note
this result is only usable with
compressFrame
. It may also be used withcompressUpdate
if no{@link #LZ4F_flush flush}
operation is performed.
-
nLZ4F_compressFrame
public static long nLZ4F_compressFrame(long dstBuffer, long dstCapacity, long srcBuffer, long srcSize, long preferencesPtr)
Unsafe version of:compressFrame
- Parameters:
dstCapacity
- MUST be ≥compressFrameBound
(srcSize, preferencesPtr)
-
LZ4F_compressFrame
public static long LZ4F_compressFrame(java.nio.ByteBuffer dstBuffer, java.nio.ByteBuffer srcBuffer, @Nullable LZ4FPreferences preferencesPtr)
Compress an entiresrcBuffer
into a valid LZ4 frame.The
LZ4F_preferences_t
structure is optional: you can provideNULL
as argument. All preferences will be set to default.- Returns:
- number of bytes written into
dstBuffer
or an error code if it fails (can be tested usingisError
)
-
LZ4F_getVersion
public static int LZ4F_getVersion()
-
nLZ4F_createCompressionContext
public static long nLZ4F_createCompressionContext(long cctxPtr, int version)
Unsafe version of:createCompressionContext
-
LZ4F_createCompressionContext
public static long LZ4F_createCompressionContext(org.lwjgl.PointerBuffer cctxPtr, int version)
The first thing to do is to create acompressionContext
object, which will be used in all compression operations. This is achieved usingLZ4F_createCompressionContext()
, which takes as argument a version.The function will provide a pointer to a fully allocated
LZ4F_cctx
object. Object can release its memory usingfreeCompressionContext
;
-
nLZ4F_freeCompressionContext
public static long nLZ4F_freeCompressionContext(long cctx)
-
LZ4F_freeCompressionContext
public static long LZ4F_freeCompressionContext(long cctx)
-
nLZ4F_compressBegin
public static long nLZ4F_compressBegin(long cctx, long dstBuffer, long dstCapacity, long prefsPtr)
Unsafe version of:compressBegin
- Parameters:
dstCapacity
- must be ≥HEADER_SIZE_MAX
bytes
-
LZ4F_compressBegin
public static long LZ4F_compressBegin(long cctx, java.nio.ByteBuffer dstBuffer, @Nullable LZ4FPreferences prefsPtr)
Will write the frame header intodstBuffer
.- Parameters:
prefsPtr
- optional: you can provideNULL
as argument, all preferences will then be set to default- Returns:
- number of bytes written into
dstBuffer
for the header or an error code (which can be tested usingisError
)
-
nLZ4F_compressBound
public static long nLZ4F_compressBound(long srcSize, long prefsPtr)
Unsafe version of:compressBound
-
LZ4F_compressBound
public static long LZ4F_compressBound(long srcSize, @Nullable LZ4FPreferences prefsPtr)
Provides minimumdstCapacity
required to guarantee compression success given asrcSize
and preferences, covering worst case scenario.Estimation is valid for either
compressUpdate
,flush
orcompressEnd
. Estimation includes the possibility that internal buffer might already be filled by up to(blockSize-1)
bytes. It also includes frame footer(ending + checksum)
, which would have to be generated bycompressEnd
. Estimation doesn't include frame header, as it was already generated bycompressBegin
.Result is always the same for a
srcSize
andprefsPtr
, so it can be trusted to size reusable buffers.When
srcSize==0
,LZ4F_compressBound()
provides an upper bound forflush
andcompressEnd
operations.- Parameters:
prefsPtr
- optional: whenNULL
is provided, preferences will be set to cover worst case scenario
-
nLZ4F_compressUpdate
public static long nLZ4F_compressUpdate(long cctx, long dstBuffer, long dstCapacity, long srcBuffer, long srcSize, long cOptPtr)
Unsafe version of:compressUpdate
-
LZ4F_compressUpdate
public static long LZ4F_compressUpdate(long cctx, java.nio.ByteBuffer dstBuffer, java.nio.ByteBuffer srcBuffer, @Nullable LZ4FCompressOptions cOptPtr)
LZ4F_compressUpdate()
can be called repetitively to compress as much data as necessary.Important rule:
dstCapacity
MUST be large enough to ensure operation success even in worst case situations. This value is provided bycompressBound
. If this condition is not respected,LZ4F_compress()
will fail (result is anerrorCode
).LZ4F_compressUpdate()
doesn't guarantee error recovery. When an error occurs, compression context must be freed or resized.- Parameters:
cOptPtr
- optional:NULL
can be provided, in which case all options are set to default- Returns:
- number of bytes written into
dstBuffer
(it can be zero, meaning input data was just buffered) or an error code if it fails (which can be tested usingisError
)
-
nLZ4F_flush
public static long nLZ4F_flush(long cctx, long dstBuffer, long dstCapacity, long cOptPtr)
Unsafe version of:flush
- Parameters:
dstCapacity
- must be large enough to ensure the operation will be successful
-
LZ4F_flush
public static long LZ4F_flush(long cctx, java.nio.ByteBuffer dstBuffer, @Nullable LZ4FCompressOptions cOptPtr)
When data must be generated and sent immediately, without waiting for a block to be completely filled, it's possible to callflush
. It will immediately compress any data buffered withincctx
.- Parameters:
cOptPtr
- optional: it's possible to provideNULL
, all options will be set to default- Returns:
- nb of bytes written into
dstBuffer
(can be zero, when there is no data stored withincctx
) or an error code if it fails (which can be tested usingisError
)
-
nLZ4F_compressEnd
public static long nLZ4F_compressEnd(long cctx, long dstBuffer, long dstCapacity, long cOptPtr)
Unsafe version of:compressEnd
-
LZ4F_compressEnd
public static long LZ4F_compressEnd(long cctx, java.nio.ByteBuffer dstBuffer, @Nullable LZ4FCompressOptions cOptPtr)
To properly finish an LZ4 frame, invokecompressEnd
. It will flush whatever data remained withincctx
(likeflush
) and properly finalize the frame, with anendMark
and achecksum
.- Parameters:
cOptPtr
- optional:NULL
can be provided, in which case all options will be set to default- Returns:
- nb of bytes written into
dstBuffer
, necessarily ≥ 4 (endMark
), or an error code if it fails (which can be tested usingisError
).A successful call to
compressEnd
makescctx
available again for another compression task.
-
nLZ4F_createDecompressionContext
public static long nLZ4F_createDecompressionContext(long dctxPtr, int version)
Unsafe version of:createDecompressionContext
-
LZ4F_createDecompressionContext
public static long LZ4F_createDecompressionContext(org.lwjgl.PointerBuffer dctxPtr, int version)
Create anLZ4F_dctx
object, to track all decompression operations.The function provides a pointer to an allocated and initialized
LZ4F_dctx
object.dctx
memory can be released usingfreeDecompressionContext
.
-
nLZ4F_freeDecompressionContext
public static long nLZ4F_freeDecompressionContext(long dctx)
Unsafe version of:freeDecompressionContext
-
LZ4F_freeDecompressionContext
public static long LZ4F_freeDecompressionContext(long dctx)
Frees anLZ4F_dctx
object.- Returns:
- an errorCode, which can be tested using
isError
.Result of
LZ4F_freeDecompressionContext()
indicates current state ofdecompressionContext
when being released. That is, it should be== 0
if decompression has been completed fully and correctly.
-
nLZ4F_getFrameInfo
public static long nLZ4F_getFrameInfo(long dctx, long frameInfoPtr, long srcBuffer, long srcSizePtr)
Unsafe version of:getFrameInfo
-
LZ4F_getFrameInfo
public static long LZ4F_getFrameInfo(long dctx, LZ4FFrameInfo frameInfoPtr, java.nio.ByteBuffer srcBuffer, org.lwjgl.PointerBuffer srcSizePtr)
This function extracts frame parameters (maxblockSize
,dictID
, etc.). Its usage is optional.Extracted information is typically useful for allocation and dictionary. This function works in 2 situations:
- At the beginning of a new frame, in which case it will decode information from
srcBuffer
, starting the decoding process.Input size must be large enough to successfully decode the entire frame header. Frame header size is variable, but is guaranteed to be ≤
HEADER_SIZE_MAX
bytes. It's allowed to provide more input data than this minimum. - After decoding has been started. In which case, no input is read, frame parameters are extracted from
dctx
. - If decoding has barely started, but not yet extracted information from header,
LZ4F_getFrameInfo()
will fail.
The number of bytes consumed from
srcBuffer
will be updated within*srcSizePtr
(necessarily ≤ original value). Decompression must resume from(srcBuffer + *srcSizePtr)
.Notes:
- in case of error,
dctx
is not modified. Decoding operation can resume from beginning safely - frame parameters are copied into an already allocated
LZ4F_frameInfo_t
structure
- Returns:
- an hint about how many srcSize bytes LZ4F_decompress() expects for next call, or an error code which can be tested using LZ4F_isError()
- At the beginning of a new frame, in which case it will decode information from
-
nLZ4F_decompress
public static long nLZ4F_decompress(long dctx, long dstBuffer, long dstSizePtr, long srcBuffer, long srcSizePtr, long dOptPtr)
Unsafe version of:decompress
-
LZ4F_decompress
public static long LZ4F_decompress(long dctx, java.nio.ByteBuffer dstBuffer, org.lwjgl.PointerBuffer dstSizePtr, java.nio.ByteBuffer srcBuffer, org.lwjgl.PointerBuffer srcSizePtr, LZ4FDecompressOptions dOptPtr)
Call this function repetitively to regenerate compressed data fromsrcBuffer
. The function will read up to*srcSizePtr
bytes fromsrcBuffer
, and decompress data intodstBuffer
, of capacity*dstSizePtr
.The nb of bytes consumed from
srcBuffer
will be written into*srcSizePtr
(necessarily ≤ original value). The number of bytes decompressed intodstBuffer
will be written into*dstSizePtr
(necessarily ≤ original value).The nb of bytes regenerated into
dstBuffer
is provided within*dstSizePtr
(necessarily ≤ original value).The function does not necessarily read all input bytes, so always check value in
*srcSizePtr
. Unconsumed source data must be presented again in subsequent invocations.dstBuffer
can freely change between each consecutive function invocation.dstBuffer
content will be overwritten.After a frame is fully decoded,
dctx
can be used again to decompress another frame.After a decompression error, use
resetDecompressionContext
before re-usingdctx
, to return to clean state.- Returns:
- a hint of how many
srcSize
bytesLZ4F_decompress()
expects for next call.Schematically, it's the size of the current (or remaining) compressed block + header of next block. Respecting the hint provides some small speed benefit, because it skips intermediate buffers. This is just a hint though, it's always possible to provide any
srcSize
.When a frame is fully decoded, return will be 0 (no more data expected). When provided with more bytes than necessary to decode a frame,
LZ4F_decompress()
will stop reading exactly at end of current frame, and return 0.If decompression failed, return is an error code, which can be tested using
isError
. After a decompression error, thedctx
context is not resumable. UseresetDecompressionContext
to return to clean state.
-
nLZ4F_resetDecompressionContext
public static void nLZ4F_resetDecompressionContext(long dctx)
Unsafe version of:resetDecompressionContext
-
LZ4F_resetDecompressionContext
public static void LZ4F_resetDecompressionContext(long dctx)
In case of an error, the context is left in "undefined" state. In which case, it's necessary to reset it, before re-using it.This method can also be used to abruptly stop an unfinished decompression, and start a new one using the same context resources.
- Since:
- 1.8.0
-
LZ4F_getErrorCode
public static int LZ4F_getErrorCode(long functionResult)
-
nLZ4F_createCDict
public static long nLZ4F_createCDict(long dictBuffer, long dictSize)
Unsafe version of:createCDict
-
LZ4F_createCDict
public static long LZ4F_createCDict(java.nio.ByteBuffer dictBuffer)
When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once.LZ4_createCDict()
will create a digested dictionary, ready to start future compression operations without startup delay.LZ4_CDict
can be created once and shared by multiple threads concurrently, since its usage is read-only.dictBuffer
can be released afterLZ4_CDict
creation, since its content is copied withinCDict
.
-
nLZ4F_freeCDict
public static void nLZ4F_freeCDict(long CDict)
-
LZ4F_freeCDict
public static void LZ4F_freeCDict(long CDict)
-
nLZ4F_compressFrame_usingCDict
public static long nLZ4F_compressFrame_usingCDict(long cctx, long dst, long dstCapacity, long src, long srcSize, long cdict, long preferencesPtr)
Unsafe version of:compressFrame_usingCDict
-
LZ4F_compressFrame_usingCDict
public static long LZ4F_compressFrame_usingCDict(long cctx, java.nio.ByteBuffer dst, java.nio.ByteBuffer src, long cdict, LZ4FPreferences preferencesPtr)
Compress an entiresrcBuffer
into a valid LZ4 frame using a digested Dictionary.dst
MUST be ≥compressFrameBound
(srcSize, preferencesPtr)
. If this condition is not respected, function will fail (return anerrorCode
).- Parameters:
cctx
- must point to a context created bycreateCompressionContext
.cdict
- ifNULL
, compress without a dictionarypreferencesPtr
- optional: you may provideNULL
as argument, but it's not recommended, as it's the only way to providedictID
in the frame header- Returns:
- number of bytes written into
dstBuffer
or an error code if it fails (can be tested usingisError
)
-
nLZ4F_compressBegin_usingCDict
public static long nLZ4F_compressBegin_usingCDict(long cctx, long dstBuffer, long dstCapacity, long cdict, long prefsPtr)
Unsafe version of:compressBegin_usingCDict
-
LZ4F_compressBegin_usingCDict
public static long LZ4F_compressBegin_usingCDict(long cctx, java.nio.ByteBuffer dstBuffer, long cdict, LZ4FPreferences prefsPtr)
Inits streaming dictionary compression, and writes the frame header intodstBuffer
.dstCapacity
must be ≥HEADER_SIZE_MAX
bytes.- Parameters:
prefsPtr
- optional: you may provideNULL
as argument, however, it's the only way to providedictID
in the frame header- Returns:
- number of bytes written into
dstBuffer
for the header, or an error code (which can be tested usingisError
)
-
nLZ4F_decompress_usingDict
public static long nLZ4F_decompress_usingDict(long dctxPtr, long dstBuffer, long dstSizePtr, long srcBuffer, long srcSizePtr, long dict, long dictSize, long decompressOptionsPtr)
Unsafe version of:decompress_usingDict
-
LZ4F_decompress_usingDict
public static long LZ4F_decompress_usingDict(long dctxPtr, java.nio.ByteBuffer dstBuffer, org.lwjgl.PointerBuffer dstSizePtr, java.nio.ByteBuffer srcBuffer, org.lwjgl.PointerBuffer srcSizePtr, java.nio.ByteBuffer dict, LZ4FDecompressOptions decompressOptionsPtr)
Same asdecompress
, using a predefined dictionary.Dictionary is used "in place", without any preprocessing. It must remain accessible throughout the entire frame decoding.
-
-