appendInt8 method

void appendInt8(
  1. int value
)

Converts eight bytes from the read buffer to a signed int.

The byte order is big-endian.

@return the int value.

Implementation

void appendInt8(int value) {
  this._bufferPosition += 8;
  _ensureBuffer();
  if (value >= 0) {
    _bufferData.add((value >> 56) & 0x7f);
    _bufferData.add((value >> 48) & 0xff);
    _bufferData.add((value >> 40) & 0xff);
    _bufferData.add((value >> 32) & 0xff);
    _bufferData.add((value >> 24) & 0xff);
    _bufferData.add((value >> 16) & 0xff);
    _bufferData.add((value >> 8) & 0xff);
    _bufferData.add((value) & 0xff);
  } else {
    _bufferData.add((value >> 56) & 0x7f | 0x80);
    _bufferData.add((value >> 48) & 0xff);
    _bufferData.add((value >> 40) & 0xff);
    _bufferData.add((value >> 32) & 0xff);
    _bufferData.add((value >> 24) & 0xff);
    _bufferData.add((value >> 16) & 0xff);
    _bufferData.add((value >> 8) & 0xff);
    _bufferData.add((value) & 0xff);
  }
}