Class UintOptRleEncoder

java.lang.Object
io.keikai.doc.collab.lib0.UintOptRleEncoder

public class UintOptRleEncoder extends Object
Optimized Rle encoder that does not suffer from the mentioned problem of the basic Rle encoder. Internally uses VarInt encoder to write unsigned integers. If the input occurs multiple times, we write it as a negative number. The UintOptRleDecoder then understands that it needs to read a count. Encodes [1,2,3,3,3] as [1,2,-3,3] (once 1, once 2, three times 3)
  • Constructor Details

    • UintOptRleEncoder

      public UintOptRleEncoder()
  • Method Details

    • write

      public void write(int v)
    • toUint8Array

      public Uint8Array toUint8Array()