wire / wire-format / flatbuffers
FlatBuffers is a zero-copy serialization format by Google. A FlatBuffer: root table offset (4 bytes, relative to the buffer start), then tables. Each table: vtable offset (relative, signed 32-bit), then fields. Vtables: size (2 bytes), number of fields (2 bytes), then field offsets (2 bytes each). Strings: 4-byte length + UTF-8 data + NUL padding. Vectors: 4-byte length + elements.
aka: FlatBuffers (flat binary serialization)
spec: FlatBuffers (google.github.io/flatbuffers)
FlatBuffers is a zero-copy serialization format by Google. A FlatBuffer: root table offset (4 bytes, relative to the buffer start), then tables. Each table: vtable offset (relative, signed 32-bit), then fields. Vtables: size (2 bytes), number of fields (2 bytes), then field offsets (2 bytes each). Strings: 4-byte length + UTF-8 data + NUL padding. Vectors: 4-byte length + elements.
| field | size | meaning |
|---|---|---|
| Root table offset | 4 bytes (uoffset32) | Offset from buffer start to the root table. |
| Table | variable | vtable offset (soffset32, signed) + field data (scalars, offsets to strings/vectors/tables). |
| VTable | variable | vtable size (uint16) + number of fields (uint16) + field offsets (uint16 each, 0 = absent/default). |
| String | variable | Length (uint32) + UTF-8 bytes + NUL terminator (padded to 4-byte alignment). |
| Vector | variable | Length (uint32) + elements (padded to element alignment). |
| Struct | fixed | Inline fixed-size data (no vtable, no indirection). |
example:
10 00 00 00 00 00 08 00 0c 00 00 00 00 00 00 00 00 00 00 00
FlatBuffer: root offset 16, empty table with vtable
agent: curl -H 'accept: application/json' wire.phall.io/wire-format/flatbuffers
or /wire-format/flatbuffers.json