Class StringEncoder

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

public class StringEncoder extends Object
Optimized String Encoder. Encoding many small strings in a simple Encoder is not very efficient. The function call to decode a string takes some time and creates references that must be eventually deleted. In practice, when decoding several million small strings, the GC will kick in more and more often to collect orphaned string objects (or maybe there is another reason?). This string encoder solves the above problem. All strings are concatenated and written as a single string using a single encoding call. The lengths are encoded using a UintOptRleEncoder.
  • Constructor Details

    • StringEncoder

      public StringEncoder()
  • Method Details

    • write

      public void write(String str)
    • toUint8Array

      public Uint8Array toUint8Array()