DocBuilder class final

Builds one VXS document.

Fields must be written in strictly ascending id order, which is what makes the encoding canonical: one logical document has exactly one byte form.

This is the single-document convenience wrapper over DocSink. For batches, use DocSink directly: it writes many documents into one buffer with no per-document allocation.

Constructors

DocBuilder({int schemaId = 0, int schemaVersion = 1, int capacity = 256})
Creates a builder. capacity is the initial buffer size, not a limit.

Properties

hashCode → int
The hash code for this object.
no setterinherited
length → int
Bytes written so far, including the reserved header.
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
schemaId ↔ int
Schema id written into the header.
getter/setter pair
schemaVersion ↔ int
Schema version written into the header.
getter/setter pair

Methods

finish({bool checksum = false}) → Bytes
Patches the header and returns the finished document.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
putBool(int fieldId, bool value) → void
Writes a boolean field.
putBytes(int fieldId, List<int> value) → void
Writes an opaque bytes field.
putDoc(int fieldId, Bytes doc) → void
Writes an already encoded document (including its header) as a nested doc.
putFloat32(int fieldId, double value) → void
Writes a float32 field.
putFloat64(int fieldId, double value) → void
Writes a float64 field.
putInt(int fieldId, int value) → void
Writes a signed integer field using zigzag varints.
putIntList(int fieldId, List<int> values) → void
Writes a List<int> field.
putRawEntry(int fieldId, int wireType, Uint8List source, int start, int end) → void
Copies an encoded value verbatim, for forward-compatibility round trips.
putString(int fieldId, String value) → void
Writes a UTF-8 string field.
putStringList(int fieldId, List<String> values) → void
Writes a List<String> field.
putUnsigned(int fieldId, int value) → void
Writes an unsigned varint field without zigzag.
reset({int? schemaId, int? schemaVersion}) → void
Discards the contents while keeping the configured capacity.
toString() → String
A string representation of this object.
inherited

Operators

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