@@ -19,15 +19,16 @@ keys.
1919
2020## Overview
2121
22- KEncode provides three entry points for compact, ASCII-safe representations :
22+ KEncode provides three standalone entry points:
2323
24- 1 . ** ByteEncoding** codecs: Base62, Base36, Base64, and Base85 encoders
24+ 1 . ** ByteEncoding** text codecs: Base62, Base36, Base64, and Base85 encoders
2525 for raw binary data.
26262 . ** PackedFormat** : A binary serializer optimized for Kotlin that supports
2727 nested objects, lists, and maps. It uses bitsets for booleans and nullability
2828 to minimize overhead.
29- 3 . ** EncodedFormat** : A wrapper that combines a binary format, an optional
30- checksum, and a text codec to produce deterministic string identifiers.
29+ 3 . ** EncodedFormat** : A wrapper for the above that combines a binary format,
30+ an optional checksum, and a text codec to produce small deterministic string
31+ identifiers.
3132
3233### Installation
3334
@@ -37,8 +38,8 @@ dependencies {
3738}
3839```
3940
40- For PackedFormat and EncodedFormat you also need to load the serialization
41- plugin.
41+ For PackedFormat and EncodedFormat you also need to load the
42+ ` kotlinx.serialization ` plugin and core library .
4243
4344### Full serialization example
4445
@@ -49,7 +50,7 @@ Minimal example using the default EncodedFormat (Base62 + PackedFormat):
4950data class Payload (
5051 @VarUInt val id : ULong , // varint
5152 @VarInt val delta : Int , // zig-zag + varint
52- val urgent : Boolean , // joined to bitset
53+ val urgent : Boolean , // these 3 are joined to bitset
5354 val sensitive : Boolean ,
5455 val external : Boolean ,
5556 val handled : Instant ? , // nullable, tracked via bitset
@@ -78,7 +79,7 @@ val decoded = EncodedFormat.decodeFromString<Payload>(encoded)
7879## PackedFormat
7980
8081PackedFormat is a BinaryFormat designed to produce the smallest feasible
81- payloads for Kotlin classes by moving structural metadata into a header.
82+ payloads for Kotlin classes by moving structural metadata into a compact header.
8283
8384* Bit-Packing: Booleans and nullability markers are stored in a single
8485 bit-header (about 1 bit per field).
@@ -94,7 +95,7 @@ For a standard class, the encoding follows this structure:
94951 . Bitmask Header: A variable length bitset containing bits for all booleans and
9596 nullable indicators. A class with 10 booleans and 5 nullable fields uses 2
9697 bytes for the header (the boolean variables are inlined to the header).
97- 2 . Payload bytes: Fields are encoded in declaration order.
98+ 2 . Payload bytes: Fields are encoded in declaration order:
9899 * Primitives: Encoded densely (VarInt for Int/Long, fixed for others).
99100 * Strings: [ varint length] [ UTF-8 bytes ] .
100101 * Nested Objects: Recursively encodes the child object with its own header.
@@ -130,9 +131,10 @@ KEncode includes standalone codecs for byte-to-text conversion. All
130131implementations support custom alphabets.
131132
132133* Base62 / Base36: Uses fixed-block encoding for predictable lengths without
133- padding. Main use is to have 100% alpha-numeric output.
134+ padding. Main use is to have 100% alpha-numeric output, with or without
135+ upper-case.
134136* Base85: High-density encoding (4 bytes to 5 characters).
135- * Base64 / URL-Safe : RFC 4648 compatible.
137+ * Base64 / Base64UrlSafe : RFC 4648 compatible.
136138
137139---
138140
0 commit comments