decodeLenBytes function

int decodeLenBytes(
  1. Uint8List buf,
  2. int offset
)

Implementation

int decodeLenBytes(Uint8List buf, int offset) {
  if (buf[offset] < 0x80) return 1;
  if (buf[offset] == 0x80) throw 'Invalid length 0';
  if (buf[offset] == 0x81) return 2;
  if (buf[offset] == 0x82) return 3;
  if (buf[offset] == 0x83) return 4;
  throw 'Length too long (> 4 bytes)';
}