Class IntDiffOptRleEncoder

java.lang.Object
io.keikai.doc.collab.lib0.Encoder
io.keikai.doc.collab.lib0.IntDiffOptRleEncoder
All Implemented Interfaces:
IntWriteEncoder

public class IntDiffOptRleEncoder extends Encoder implements IntWriteEncoder
A combination of the IntDiffEncoder and the UintOptRleEncoder. The count approach is similar to the UintDiffOptRleEncoder, but instead of using the negative bitflag, it encodes in the LSB whether a count is to be read. Therefore, this Encoder only supports 31 bit integers! Encodes [1, 2, 3, 2] as [3, 1, 6, -1] (more specifically [(1 << 1) | 1, (3 << 0) | 0, -1]) Internally uses variable length encoding. Contrary to normal UintVar encoding, the first byte contains: 1 bit that denotes whether the next value is a count (LSB) 1 bit that denotes whether this value is negative (MSB - 1) 1 bit that denotes whether to continue reading the variable length integer (MSB) Therefore, only five bits remain to encode diff ranges. Use this Encoder only when appropriate. In most cases, this is probably a bad idea.
  • Constructor Details

    • IntDiffOptRleEncoder

      public IntDiffOptRleEncoder()
  • Method Details