Tak Compressor
Compresses TAKPacketV2 protobuf bytes using zstd with pre-trained dictionaries, and decompresses received wire payloads back to protobuf bytes.
Wire format: zstd-compressed protobuf bytes Flags byte bits 0-5 = dictionary ID, bits 6-7 = reserved. Special value 0xFF = uncompressed raw protobuf.
Multiplatform: the zstd codec itself is reached through the internal ZstdCodec, a single pure-Kotlin implementation used on every target. The wire framing — the 4-byte magic strip/re-prepend, the 0xFF skip-compress path, the dict-ID flags masking, and the MAX_DECOMPRESSED_SIZE guard — all live HERE, above the codec, so every target shares one framing implementation.
Types
Result of compressWithRemarksFallbackDetailed.
Functions
Compress a TakPacketV2Data into a wire payload: zstd-compressed protobuf
Compress a packet, stripping remarks if the result exceeds maxWireBytes.
Compress a packet, stripping remarks if needed, and return a detailed result that distinguishes the four possible outcomes:
Compress and return both the wire payload and intermediate sizes for reporting.
Decompress a wire payload back to a TakPacketV2Data. Handles both compressed (dict-based) and uncompressed (0xFF) payloads.