readUint24 method Null safety

  1. @override
int readUint24()
override

Read a 24-bit word from the stream.

Implementation

@override
int readUint24() {
  var b1 = 0;
  var b2 = 0;
  var b3 = 0;
  if ((_bufferPosition + 3) < _bufferSize) {
    b1 = _buffer[_bufferPosition++] & 0xff;
    b2 = _buffer[_bufferPosition++] & 0xff;
    b3 = _buffer[_bufferPosition++] & 0xff;
  } else {
    b1 = readByte();
    b2 = readByte();
    b3 = readByte();
  }

  if (byteOrder == BIG_ENDIAN) {
    return b3 | (b2 << 8) | (b1 << 16);
  }
  return b1 | (b2 << 8) | (b3 << 16);
}