readUint8ListViewOrCopy method

Uint8List readUint8ListViewOrCopy(
  1. int length
)

Returns the next bytes. Length is determined by the argument.

If isCopyOnRead is true, the method will return a new copy of the bytes. Otherwise the method will return a view at the bytes.

Implementation

Uint8List readUint8ListViewOrCopy(int length) {
  if (length == null) {
    length = availableLengthInBytes;
  } else if (length > _byteData.lengthInBytes - index) {
    throw new ArgumentError.value(length, "length");
  }
  if (isCopyOnRead) {
    return readUint8ListCopy(length);
  }
  return _readUint8ListView(length);
}