readLengthCodedBinary method

int? readLengthCodedBinary()

Reads a length coded binary from the buffer. This is specified in the mysql docs. It will read up to nine bytes from the stream, depending on the first byte. Returns an unsigned integer.

Implementation

int? readLengthCodedBinary() {
  int first = byte;
  if (first < 251) {
    return first;
  }
  switch (first) {
    case 251:
      return null;
    case 252:
      return uint16;
    case 253:
      return uint24;
    case 254:
      return uint64;
  }
  throw ArgumentError('value is out of range');
}