Package io.keikai.doc.collab.lib0
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 theIntDiffEncoderand theUintOptRleEncoder. 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 Summary
Constructors Constructor Description IntDiffOptRleEncoder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Uint8ArraytoUint8Array()voidwrite(int v)
-
-
-
Method Detail
-
write
public void write(int v)
- Specified by:
writein interfaceIntWriteEncoder
-
toUint8Array
public Uint8Array toUint8Array()
-
-