Class UpdateDecoderV2

java.lang.Object
io.keikai.doc.collab.utils.DSDecoderV2
io.keikai.doc.collab.utils.UpdateDecoderV2
All Implemented Interfaces:
DSDecoder, UpdateDecoder

public class UpdateDecoderV2 extends DSDecoderV2 implements UpdateDecoder
  • Constructor Details

    • UpdateDecoderV2

      public UpdateDecoderV2(Decoder decoder)
  • Method Details

    • readLeftID

      public ID readLeftID()
      Specified by:
      readLeftID in interface UpdateDecoder
      Returns:
      ID with the left client ID and clock
    • readRightID

      public ID readRightID()
      Specified by:
      readRightID in interface UpdateDecoder
      Returns:
      ID with the right client ID and clock
    • readClient

      public int readClient()
      Read the next client ID. Use this in favor of readID whenever possible to reduce the number of objects created.
      Specified by:
      readClient in interface UpdateDecoder
    • readInfo

      public int readInfo()
      Specified by:
      readInfo in interface UpdateDecoder
      Returns:
      info An unsigned 8-bit integer
    • readString

      public String readString()
      Specified by:
      readString in interface UpdateDecoder
      Returns:
      the next string
    • readParentInfo

      public boolean readParentInfo()
      Specified by:
      readParentInfo in interface UpdateDecoder
      Returns:
      parent info as a boolean
    • readTypeRef

      public int readTypeRef()
      Specified by:
      readTypeRef in interface UpdateDecoder
      Returns:
      Type reference as an unsigned 8-bit integer
    • readLen

      public int readLen()
      Description copied from interface: UpdateDecoder
      Write len of a struct - well suited for Opt RLE encoder.
      Specified by:
      readLen in interface UpdateDecoder
      Returns:
      length of a struct, well suited for Opt RLE decoder
    • readAny

      public Object readAny()
      Specified by:
      readAny in interface UpdateDecoder
      Returns:
      the next "any" value
    • readBuf

      public Uint8Array readBuf()
      Specified by:
      readBuf in interface UpdateDecoder
      Returns:
      the next byte array
    • readJSON

      public Object readJSON()
      This is mainly here for legacy purposes. Initially, we encoded objects using JSON. Now we use the much faster lib0/any-encoder. This method mainly exists for legacy purposes for the v1 encoder.
      Specified by:
      readJSON in interface UpdateDecoder
      Returns:
      the next JSON object
    • readKey

      public String readKey()
      Specified by:
      readKey in interface UpdateDecoder
      Returns:
      the next key string