FugueTextBinaryCodec class

Compact, fast binary codec for a text Fugue (Fugue<String>).

Format (all integers unsigned LEB128 varints):

u8      version (1)
varint  R = replica count
R×      [varint len][UTF-8 replica id]        // interned dictionary
varint  B = block count
B×      varint  start replica index
        varint  start counter
        u8      flags: bit0 = side (0=left,1=right), bit7 = parent is origin
        if !origin: varint parent replica index, varint parent counter
        varint  UTF-8 byte length of the run
        …bytes  the run's values joined as one UTF-8 string
        varint  element count
        varint  D = deleted-range count
        D×      varint start, varint len

Replica interning + varints + one packed UTF-8 string per run make this several times smaller and faster than JSON, which repeats the replica id in every block and stores each character as its own string.

Assumes each element is a single Unicode scalar (as produced by char-level text editing): a run is joined and split by runes.

Constructors

FugueTextBinaryCodec()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

decode(Uint8List bytes) Fugue<String>
Decode a buffer produced by encode.
encode(Fugue<String> f) Uint8List
Encode f to a compact byte buffer.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited