Top-level
| Entry point | Use it to |
|---|---|
| EncodedFormat | Encode a @Serializable value as a short string and back. |
| PackedFormat | Get the compact ByteArray without the text layer. |
| ByteEncoding | Encode raw bytes with Base62, Base36, Base64, or Base85. |
val encoded = EncodedFormat.encodeToString(payload)
val decoded = EncodedFormat.decodeFromString<Payload>(encoded)Configure formats with the builder lambda: set the codec, add a checksum, or chain PayloadTransforms. Annotate Int/Long fields with PackedType to choose an IntPacking.
Types
Padded RFC 4648 Base64 codec.
Base64 with the BASE_64_URL alphabet.
Base85 codec: 4 bytes to 5 characters, and a final 1–3 bytes to 2–4 characters.
Alphabet of the characters in chars.
Replaces leading zero bytes with a 0x00 sentinel and a varint count, which pays off from three zeros. Payloads starting with a non-zero byte pass through unchanged. At most 65,536 zeros are stripped.
StringFormat that serializes with a BinaryFormat, applies an optional PayloadTransform, and encodes the bytes with a ByteEncoding. Defaults to PackedFormat and Base62.
Builder for EncodedFormat.
Integer encoding for Int and Long fields in PackedFormat.
PackedFormat decoder.
PackedFormat encoder.
Compact BinaryFormat for Kotlin classes.
Builder for PackedFormat.
Sets the IntPacking of an Int or Long field. Without it, kotlinx.serialization.protobuf.ProtoType applies if present, then PackedConfiguration.defaultEncoding.
Byte transform between the binary format and the text codec, such as a checksum, encryption, or error correction. decode(encode(data)) must equal data.
size consecutive BMP characters from start. Defaults to U+0020–U+D7FF, the largest range below the surrogate block.
Functions
Appends the digest on encode; verifies and strips it on decode.
Creates an EncodedFormat.
Creates a PackedFormat.
Runs this then next on encode, and the reverse on decode.