Class KeyListEncoder

java.lang.Object
io.permazen.kv.util.KeyListEncoder

public final class KeyListEncoder extends Object
Serializes a sequence of byte[] arrays, compressing consecutive common prefixes.

Keys are encoded/decoded by read() and write() in one of two forms:

  • total-length bytes...
  • -prefix-length suffix-length suffix-bytes ...
The first length (total-length or negative prefix-length) is encoded using LongEncoder. The suffix-length, if present, is encoded using UnsignedIntEncoder.

Support for encoding and decoding an entire iteration of key/value pairs is supported via readPairs() and writePairs().