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() {
  var first = readByte();
  if (first < 251) {
    return first;
  }
  switch (first) {
    case 251:
      return null;
    case 252:
      return readUint16();
    case 253:
      return readUint24();
    case 254:
      return readUint64();
  }
  throw ArgumentError('value is out of range');
}