readSize method
- ReadBuffer buffer
Reads a non-negative int from buffer
as written by writeSize.
This method is intended for use by subclasses overriding readValueOfType.
Implementation
int readSize(ReadBuffer buffer) {
final int value = buffer.getUint8();
return switch (value) {
254 => buffer.getUint16(),
255 => buffer.getUint32(),
_ => value,
};
}