koni_codecs library

Pure Dart compression codecs as synchronous chunked converters, usable standalone with no archive knowledge.

Available codecs: InflateDecoder (raw DEFLATE, RFC 1951) and GzipDecoder (gzip framing incl. multi-member, RFC 1952), plus the resumable engines (RawInflater, RawGzipDecoder) for framing layers. More codecs land milestone by milestone (LZMA at M8, …). On malformed input, everything in this package throws FormatException; the archive layer translates that into its typed exception hierarchy.

Cryptographic primitives (AES, SHA, HMAC, PBKDF2; Phase 3) live in the separate package:koni_codecs/crypto.dart entrypoint.

Classes

BitReader
Least-significant-bit-first bit cursor over a byte buffer, the bit order DEFLATE (RFC 1951) uses.
DeflateEncoder
DEFLATE (RFC 1951) compression as a synchronous, chunk-driven converter, the encoding counterpart of InflateDecoder.
GzipDecoder
gzip (RFC 1952) decompression as a synchronous, chunk-driven state machine, including multi-member files (concatenated streams). Malformed input throws FormatException; the archive layer translates.
GzipMemberHeader
Parsed metadata of one gzip member header (RFC 1952).
InflateDecoder
DEFLATE (RFC 1951) decompression as a synchronous, chunk-driven state machine: input may arrive split at any byte boundary, output is emitted in bounded chunks, and no await appears anywhere. Malformed input throws FormatException (the dart:convert idiom; the archive layer translates).
Lzma2Decoder
LZMA2 decompression: chunked LZMA with reset control, 7z's default codec and xz's payload format.
Lzma2Encoder
LZMA2 compression: chunked LZMA with reset control, the encode direction of Lzma2Decoder. 7z's default codec and xz's payload format.
LzmaDecoder
LZMA decompression, the primary 7z codec.
LzmaEncoder
LZMA compression, the encode direction of LzmaDecoder.
RangeEncoder
LZMA range encoder, the encode-direction mirror of the range coder inside LzmaDecoder.
RawDeflater
Resumable raw-DEFLATE compressor, the engine under DeflateEncoder.
RawGzipDecoder
Resumable multi-member gzip decoder, the engine under GzipDecoder, public for the archive layer (koni_gzip), which needs chunk-driven decoding with per-member metadata.
RawInflater
Resumable raw-DEFLATE decompressor, the engine under InflateDecoder, public for framing layers (gzip, ZIP) that must locate the end of the stream and reclaim trailing bytes.

Functions

bcjX86Decode(Uint8List data) → void
Reverses the x86 BCJ filter in place (whole-buffer, start address 0): converts absolute CALL/JMP (0xE8/0xE9) targets back to relative.
crc32OfSlice(Uint8List bytes, int start, int end) int
One-shot CRC-32 of bytes[start..end).
crc32Update(int crc, Uint8List bytes, int start, int end) int
Updates a running CRC-32 (pass 0xFFFFFFFF initially; finalize by XOR-ing with 0xFFFFFFFF). Exposed for framing internals and tests.
deltaDecode(Uint8List data, int distance) → void
Reverses a delta filter in place: data[i] += data[i - distance].
tryParseGzipHeader(Uint8List bytes, {bool verifyHeaderCrc = true}) → (GzipMemberHeader, int)?
Attempts to parse a gzip member header at the start of bytes.