writeBytes method

void writeBytes(
  1. ByteArray bytes, [
  2. int offset = 0,
  3. int byteCount = 0
])

Copies bytes from bytes to this

Implementation

void writeBytes(ByteArray bytes, [int offset = 0, int byteCount = 0])
{
  if (byteCount == 0) byteCount = bytes.length; // ignore: parameter_assignments

  // Copy old offset so we can reset it after copy
  final oldOffset = bytes.offset;
  bytes.offset = offset;

  for (var i = 0; i < byteCount; i++)
    writeByte(bytes.readByte());

  bytes.offset = oldOffset;
}