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 using lz4frame.h, except to get constant such as VERSION_NUMBER.
| Modifier and Type | Field and Description |
|---|---|
| public static final int | LZ4F_BLOCK_CHECKSUM_SIZE
Size in bytes of a block checksum footer in little-endian format. |
| public static final int | LZ4F_BLOCK_HEADER_SIZE
Size in bytes of a block header in little-endian format. |
| public static final int | |
| public static final int | LZ4F_blockIndependent
Linked blocks sharply reduce inefficiencies when using small blocks, they compress better. |
| public static final int | LZ4F_blockLinked
Linked blocks sharply reduce inefficiencies when using small blocks, they compress better. |
| public static final int | LZ4F_CONTENT_CHECKSUM_SIZE
Size in bytes of the content checksum. |
| public static final int | LZ4F_contentChecksumEnabled
|
| public static final int | LZ4F_default
The larger the block size, the (slightly) better the compression ratio, though there are diminishing returns. |
| public static final LZ4FCustomMem | LZ4F_defaultCMem
This constant defers to stdlib's functions |
| public static final int | LZ4F_ERROR_allocation_failed
Error code. |
| public static final int | LZ4F_ERROR_blockChecksum_invalid
Error code. |
| public static final int | LZ4F_ERROR_blockMode_invalid
Error code. |
| public static final int | LZ4F_ERROR_compressionLevel_invalid
Error code. |
| public static final int | LZ4F_ERROR_compressionState_uninitialized
Error code. |
| public static final int | LZ4F_ERROR_contentChecksum_invalid
Error code. |
| public static final int | LZ4F_ERROR_contentChecksumFlag_invalid
Error code. |
| public static final int | LZ4F_ERROR_decompressionFailed
Error code. |
| public static final int | LZ4F_ERROR_dstMaxSize_tooSmall
Error code. |
| public static final int | LZ4F_ERROR_frameDecoding_alreadyStarted
Error code. |
| public static final int | LZ4F_ERROR_frameHeader_incomplete
Error code. |
| public static final int | LZ4F_ERROR_frameSize_wrong
Error code. |
| public static final int | LZ4F_ERROR_frameType_unknown
Error code. |
| public static final int | LZ4F_ERROR_GENERIC
Error code. |
| public static final int | LZ4F_ERROR_headerChecksum_invalid
Error code. |
| public static final int | LZ4F_ERROR_headerVersion_wrong
Error code. |
| public static final int | LZ4F_ERROR_maxBlockSize_invalid
Error code. |
| public static final int | LZ4F_ERROR_maxCode
Error code. |
| public static final int | LZ4F_ERROR_parameter_null
Error code. |
| public static final int | LZ4F_ERROR_reservedFlag_set
Error code. |
| public static final int | LZ4F_ERROR_srcPtr_wrong
Error code. |
| public static final int | LZ4F_ERROR_srcSize_tooLarge
Error code. |
| public static final int | |
| public static final int | LZ4F_HEADER_SIZE_MAX
Maximum header size. |
| public static final int | LZ4F_HEADER_SIZE_MIN
Minimum header size. |
| public static final int | |
| public static final int | |
| public static final int | LZ4F_max1MB
The larger the block size, the (slightly) better the compression ratio, though there are diminishing returns. |
| public static final int | LZ4F_max256KB
The larger the block size, the (slightly) better the compression ratio, though there are diminishing returns. |
| public static final int | LZ4F_max4MB
The larger the block size, the (slightly) better the compression ratio, though there are diminishing returns. |
| public static final int | LZ4F_max64KB
The larger the block size, the (slightly) better the compression ratio, though there are diminishing returns. |
| public static final int | |
| public static final int | |
| public static final int | |
| public static final int | LZ4F_OK_NoError
Error code. |
| public static final int | |
| public static final int | LZ4F_VERSION
Version number. |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description | |
|---|---|---|
| public static long | Returns: number of bytes written intodstBuffer for the header or an error code (which can be tested using isError)optional: you can provide prefsPtr)NULL as argument, all preferences will then be set to defaultWill write the frame header into | |
| public static long | Returns: number of bytes written intodstBuffer for the header, or an error code (which can be tested using isError)optional: you may provide prefsPtr)NULL as argument, however, it's the only way to provide dictID in the frame headerInits streaming dictionary compression, and writes the frame header into | |
| public static long | LZ4F_compressBound(long srcSize, LZ4FPreferences
optional: when prefsPtr)NULL is provided, preferences will be set to cover worst case scenarioProvides minimum | |
| public static long | Returns: nb of bytes written intodstBuffer, necessarily ≥ 4 (endMark), or an error code if it fails (which can be tested using isError).
A successful call to optional: cOptPtr)NULL can be provided, in which case all options will be set to defaultTo properly finish an LZ4 frame, invoke | |
| public static long | Returns: number of bytes written intodstBuffer or an error code if it fails (can be tested using isError)Compress an entire | |
| public static long | Returns: number of bytes written intodstBuffer or an error code if it fails (can be tested using isError)must point to a context created by cctx, ByteBuffer dst, ByteBuffer src, long createCompressionContext.if cdict, LZ4FPreferences NULL, compress without a dictionaryoptional: you may provide preferencesPtr)NULL as argument, but it's not recommended, as it's the only way to provide dictID in the frame headerCompress an entire | |
| public static long | LZ4F_compressFrameBound(long srcSize, LZ4FPreferences preferencesPtr)
Returns the maximum possible size of a frame compressed with | |
| public static native int | ||
| public static long | Returns: number of bytes written intodstBuffer (it can be zero, meaning input data was just buffered) or an error code if it fails (which can be tested
using isError)optional: cOptPtr)NULL can be provided, in which case all options are set to default
| |
| public static long | LZ4F_createCDict(ByteBuffer dictBuffer)
When compressing multiple messages / blocks with the same dictionary, it's recommended to load it just once. | |
| public static long | LZ4F_createCDict_advanced(LZ4FCustomMem customMem, ByteBuffer dictBuffer)
| |
| public static long | Returns: if!= zero, context creation failed.MUST be != cctxPtr, int version)NULLThe first thing to do is to create a | |
| public static long | LZ4F_createCompressionContext_advanced(LZ4FCustomMem customMem, int version)
| |
| public static long | Returns: an errorCode, which can be tested usingisErrorMUST be valid dctxPtr, int must be: version)
Create an | |
| public static long | LZ4F_createDecompressionContext_advanced(LZ4FCustomMem customMem, int version)
| |
| public static long | Returns: a hint of how manysrcSize bytes LZ4F_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 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,
If decompression failed, return is an error code, which can be tested using Call this function repetitively to regenerate data compressed in | |
| public static long | LZ4F_decompress_usingDict(long dctxPtr, ByteBuffer dstBuffer, PointerBuffer dstSizePtr, ByteBuffer srcBuffer, PointerBuffer srcSizePtr, ByteBuffer dict, LZ4FDecompressOptions decompressOptionsPtr)
Same as | |
| private static LZ4FCustomMem | ||
| public static long | Returns: nb of bytes written intodstBuffer (can be zero, when there is no data stored within cctx) or an error code if it fails (which can be
tested using isError)optional: it's possible to provide cOptPtr)NULL, all options will be set to defaultWhen data must be generated and sent immediately, without waiting for a block to be completely filled, it's possible to call | |
| public static void | ||
| public static native long | ||
| public static long | Returns: an errorCode, which can be tested usingisError.
Result of Frees an | |
| public static native long | LZ4F_getBlockSize(int blockSizeID)
Return, in scalar format ( | |
| public static native int | ||
| public static String | ||
| public static long | 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()This function extracts frame parameters (max | |
| public static native int | ||
| public static long | Returns: size of frame header or an error code, which can be tested usingisErrorProvide the header size of a frame starting at | |
| public static boolean | ||
| public static void | LZ4F_resetDecompressionContext(long dctx)
In case of an error, the context is left in "undefined" state. | |
| public static long | Returns: number of bytes written intodstBuffer (it can be zero, meaning input data was just buffered), or an error code if it fails (which can be
tested using isError)"optional : cOptPtr)NULL can be provided, in which case all options are set to defaultCan be called repetitively to add as much data uncompressed data as necessary. | |
| public static native long | nLZ4F_compressBegin(long cctx, long dstBuffer, long
must be ≥ dstCapacity, long prefsPtr)HEADER_SIZE_MAX bytesUnsafe version of: | |
| public static native long | nLZ4F_compressBegin_usingCDict(long cctx, long dstBuffer, long dstCapacity, long cdict, long prefsPtr)
Unsafe version of: | |
| public static native long | ||
| public static native long | nLZ4F_compressEnd(long cctx, long dstBuffer, long dstCapacity, long cOptPtr)
Unsafe version of: | |
| public static native long | nLZ4F_compressFrame(long dstBuffer, long
MUST be ≥ dstCapacity, long srcBuffer, long srcSize, long preferencesPtr)compressFrameBound(srcSize, preferencesPtr)Unsafe version of: | |
| public static native long | nLZ4F_compressFrame_usingCDict(long cctx, long dst, long dstCapacity, long src, long srcSize, long cdict, long preferencesPtr)
Unsafe version of: | |
| public static native long | ||
| public static native long | nLZ4F_compressUpdate(long cctx, long dstBuffer, long dstCapacity, long srcBuffer, long srcSize, long cOptPtr)
Unsafe version of: | |
| public static native long | ||
| public static native long | nLZ4F_createCDict_advanced(long customMem, long dictBuffer, long dictSize)
Unsafe version of: | |
| public static native long | nLZ4F_createCompressionContext(long cctxPtr, int version)
Unsafe version of: | |
| public static native long | nLZ4F_createCompressionContext_advanced(long customMem, int version)
Unsafe version of: | |
| public static native long | nLZ4F_createDecompressionContext(long dctxPtr, int version)
Unsafe version of: | |
| public static native long | nLZ4F_createDecompressionContext_advanced(long customMem, int version)
Unsafe version of: | |
| public static native long | nLZ4F_decompress(long dctx, long dstBuffer, long dstSizePtr, long srcBuffer, long srcSizePtr, long dOptPtr)
Unsafe version of: | |
| public static native long | nLZ4F_decompress_usingDict(long dctxPtr, long dstBuffer, long dstSizePtr, long srcBuffer, long srcSizePtr, long dict, long dictSize, long decompressOptionsPtr)
Unsafe version of: | |
| private static native void | ||
| public static native long | nLZ4F_flush(long cctx, long dstBuffer, long
must be large enough to ensure the operation will be successful dstCapacity, long cOptPtr)Unsafe version of: | |
| public static native void | ||
| public static native long | ||
| public static native long | ||
| public static native long | nLZ4F_getFrameInfo(long dctx, long frameInfoPtr, long srcBuffer, long srcSizePtr)
Unsafe version of: | |
| public static native long | nLZ4F_headerSize(long src, long
must be ≥ srcSize)MIN_SIZE_TO_KNOW_HEADER_LENGTH, which is enough to decode the header lengthUnsafe version of: | |
| public static native int | ||
| public static native void | ||
| public static native long | nLZ4F_uncompressedUpdate(long cctx, long dstBuffer, long dstCapacity, long srcBuffer, long srcSize, long cOptPtr)
Unsafe version of: |