← Back to Kairo Docs|API Reference (Dokka)

DarbEncoder

DARB stands for "dense-ish albeit readable binary". It's a compact way to encode boolean lists into short strings while still keeping them human-readable.

An example DARB string is "23.2CB08E". The prefix ("23" in the example above) is the length of the list. 2 = "0010", C = "1100", B = "1011", 0 = "0000", 8 = "1000", "E" = "111" (last boolean ignored, since prefix is 23).

Functions

Link copied to clipboard
fun decode(darb: String): List<Boolean>

Decodes a DARB string back into a boolean list. Throws IllegalArgumentException if malformed.

Link copied to clipboard
fun encode(booleanList: List<Boolean>): String

Encodes a boolean list into a DARB string. The list can be any length, including empty.