Skip to content

FRONT stores each value as the number of leading bytes it shares with the previous value, plus its remaining suffix. It suits sorted or similar strings. It is codec id 2 in BytesCol.

Field Encoding Meaning
codec u8 2
shared IntCol shared-prefix length of each value with the previous one
suffixes Plain the suffix of each value, laid out as in Bytes PLAIN without its codec byte

The shared length is 0 at every 16th value (indexes 0, 16, 32, …). Those values are stored whole, so a reader can start decoding at any such index.

  1. Read the codec byte (2), the shared IntCol and the suffixes Plain.
  2. Value i is the first shared[i] bytes of value i - 1, followed by suffix i.
  3. Value 0, and every 16th value, has shared = 0 and so equals its suffix.

Derived by hand, not from a real file. The values car, cart, cat have shared lengths 0, 3, 2 and suffixes car, t, t.

02 codec FRONT
03 01 00 02 2C shared: IntCol, count 3, FOR, min 0, width 2, 0 3 2
03 01 02 02 02 suffix lens: IntCol, count 3, FOR, min 1, width 2, 3 1 1
01 00 00 offset samples: Flat, count 1, CONST 0
05 total 5
63 61 72 74 74 "car" "t" "t"

Decoded: car; car first 3 bytes + t = cart; cart first 2 bytes ca + t = cat.

  • Each shared length is at most the length of the previous value.
  • The suffix Plain passes the checks of Bytes PLAIN.

See How writers choose a codec.