readByteDataViewOrCopy method

ByteData readByteDataViewOrCopy(
  1. int length
)

Returns the next length bytes.

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

Increments index by length.

Implementation

ByteData readByteDataViewOrCopy(int length) {
  if (length == null) {
    length = availableLengthInBytes;
  } else if (length > _byteData.lengthInBytes - index) {
    throw new ArgumentError.value(length, "length");
  }
  if (isCopyOnRead) {
    return readByteDataCopy(length);
  }
  return _readByteDataView(length);
}