readIntoSync method
Implementation
int readIntoSync(Uint8List buffer, int start, int? end) {
final int usedEnd = math.min(end ?? (start + buffer.length), _length);
int bufferStartWriteIndex = 0;
int relativeStart;
do {
relativeStart = start + bufferStartWriteIndex;
final int contentIndex = relativeStart ~/ _subListSize;
if (contentIndex >= _content.length) {
break;
}
final List<int> contentSubList = _content[contentIndex];
final int subListStartIndex = relativeStart % _subListSize;
final int dataLengthToCopy = math.min(
usedEnd - relativeStart,
_subListSize - subListStartIndex,
);
buffer.setRange(
bufferStartWriteIndex,
bufferStartWriteIndex + dataLengthToCopy,
contentSubList.getRange(
subListStartIndex,
subListStartIndex + dataLengthToCopy,
),
);
bufferStartWriteIndex += dataLengthToCopy;
} while (relativeStart < usedEnd);
return usedEnd - start;
}