Skip to content

Commit fab1846

Browse files
committed
docs: split long README paragraphs
1 parent 55c5170 commit fab1846

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

README.md

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ keys.
2222
## Overview
2323

2424
KEncode has three standalone entry points. ByteEncoding is a set of text codecs
25-
(Base62, Base36, Base64, Base85) for raw binary data. PackedFormat is a
26-
kotlinx.serialization BinaryFormat that produces compact byte payloads for
27-
Kotlin classes, including nested objects, lists, and maps. EncodedFormat layers
28-
a text codec and optional payload transforms over a binary format to produce
29-
short, deterministic string identifiers.
25+
(Base62, Base36, Base64, Base85) for raw binary data.
26+
27+
PackedFormat is a kotlinx.serialization BinaryFormat that produces compact byte
28+
payloads for Kotlin classes, including nested objects, lists, and maps.
29+
30+
EncodedFormat layers a text codec and optional payload transforms over a binary
31+
format to produce short, deterministic string identifiers.
3032

3133
For a walkthrough of the bit-packing layout and design choices, see the
3234
[technical deep dive](https://eignex.com/posts/kencode-packing-data-for-strict-limits/).
@@ -72,8 +74,10 @@ val decoded = EncodedFormat.decodeFromString<Payload>(encoded)
7274
PackedFormat is a BinaryFormat for Kotlin classes that emits compact byte
7375
payloads. Booleans and nullability markers share a single bit-header (about one
7476
bit per field), and nested objects, lists, maps, and polymorphism are handled
75-
recursively. Int and Long fields can be annotated with @PackedType to choose
76-
unsigned varint or ZigZag, and @ProtoType is recognized as a fallback.
77+
recursively.
78+
79+
Int and Long fields can be annotated with @PackedType to choose unsigned varint
80+
or ZigZag, and @ProtoType is recognized as a fallback.
7781

7882
```kotlin
7983
val compactFormat = PackedFormat {
@@ -91,12 +95,15 @@ val bytes = compactFormat.encodeToByteArray(payload)
9195

9296
EncodedFormat is a StringFormat that produces short tokens by composing three
9397
layers. The binary layer is PackedFormat by default, but ProtoBuf is a good
94-
choice when cross-language compatibility matters. After serialization, an
95-
optional PayloadTransform can manipulate the bytes, for example CompactZeros to
96-
strip leading zeros, Checksum to append an integrity check, or a custom
97-
transform for encryption or error correction. Transforms compose with
98-
PayloadTransform.then. Finally a text codec turns the bytes into a string, with
99-
Base62 as the default and Base36, Base64, and Base85 available.
98+
choice when cross-language compatibility matters.
99+
100+
After serialization, an optional PayloadTransform can manipulate the bytes, for
101+
example CompactZeros to strip leading zeros, Checksum to append an integrity
102+
check, or a custom transform for encryption or error correction. Transforms
103+
compose with PayloadTransform.then.
104+
105+
Finally a text codec turns the bytes into a string, with Base62 as the default
106+
and Base36, Base64, and Base85 available.
100107

101108
```kotlin
102109
val customFormat = EncodedFormat {
@@ -118,10 +125,12 @@ val withBoth = EncodedFormat {
118125
## Base Encoders
119126

120127
KEncode ships standalone byte-to-text codecs, all of which accept custom
121-
alphabets. Base62 and Base36 use fixed-block encoding for predictable lengths
122-
without padding, and produce purely alpha-numeric output (with or without
123-
upper-case). Base85 trades alphabet size for density, encoding four bytes into
124-
five characters. Base64 and Base64Url are RFC 4648 compatible.
128+
alphabets.
129+
130+
Base62 and Base36 use fixed-block encoding for predictable lengths without
131+
padding, and produce purely alpha-numeric output (with or without upper-case).
132+
Base85 trades alphabet size for density, encoding four bytes into five
133+
characters. Base64 and Base64Url are RFC 4648 compatible.
125134

126135
Encoding `"any byte data"` (13 bytes):
127136

0 commit comments

Comments
 (0)