Skip to content

v0.6

Choose a tag to compare

@github-actions github-actions released this 27 Jun 16:57
· 26 commits to main since this release
99e7dd6

Added

  • ZstdCompressCtx.refPrefix(MemorySegment) / ZstdDecompressCtx.refPrefix(...)
    — reference native content as a single-use prefix (raw-content dictionary) for
    the next frame only: the building block for delta compression (compress a new
    version against a similar previous one). The prefix is referenced, not copied
    or digested, and writes no dictionary ID; the decompressor must reference the
    same prefix to decode. Binds ZSTD_CCtx_refPrefix / ZSTD_DCtx_refPrefix.
    Segment-only by design — heap callers that need a copy should use
    loadDictionary instead.
  • Zstd.dictId(byte[]) / Zstd.dictId(MemorySegment) — read the dictionary id
    stamped in raw dictionary bytes without wrapping them in a ZstdDictionary.
    Binds ZSTD_getDictID_fromDict.
  • ZstdDictionaryId value type — a record wrapping the 32-bit dictionary id
    with an unsigned value(), isPresent(), and the NONE sentinel for "no id".
  • ZstdFrame.decompressedSize(byte[]) / ZstdFrame.decompressedSize(MemorySegment)
    — the exact combined decompressed size of all concatenated frames, summed from
    each frame header (throws if any frame does not record its size). Complements
    decompressedBound (upper bound). Binds ZSTD_findDecompressedSize.
  • ZstdFrame.headerSize(byte[]) / ZstdFrame.headerSize(MemorySegment) — the size
    of a frame's header computed from just its leading bytes (as few as 5), without a
    full parse. Binds ZSTD_frameHeaderSize.
  • ZstdFrame.decompressionMargin(byte[]) / ZstdFrame.decompressionMargin(MemorySegment)
    — the extra room needed to decompress a frame in place (output buffer overlaps
    the compressed input at its tail), sized decompressedSize + margin. Binds
    ZSTD_decompressionMargin.
  • ZstdDictionary.compressDict(int) / compressDict() / decompressDict()
    factories for digested dictionaries, e.g. dict.compressDict(19) instead of
    new ZstdCompressDict(dict, 19). They signal that the result is AutoCloseable
    and are for sharing one digest across contexts via refDictionary; a single
    context should prefer the context-owned loadDictionary.

Changed

  • Every dictionary-id accessor now returns ZstdDictionaryId instead of int:
    ZstdDictionary.id(), ZstdCompressDict.id(), ZstdDecompressDict.id(),
    ZstdFrame.dictId(...), and ZstdFrameHeader.dictId(). The 0 sentinel is now
    ZstdDictionaryId.NONE, and the id reads as unsigned via value().
  • Zstd.decompress(byte[]) now throws ZstdException (instead of letting a raw
    ArithmeticException escape) when a frame declares a content size larger than a
    Java array can hold. The size comes from the untrusted frame header; use
    decompress(byte[], int) to bound output for untrusted input.