readTo method
Read length
bytes into io
.
Implementation
@override
int readTo(BytesIO io, [int? length]) {
length ??= remaining;
if (io is BytesUint8ListIO) {
final bytes = _bytes;
final bytes2 = io._bytes;
final offset = _position;
final offset2 = io._position;
for (var i = 0; i < length; ++i) {
var b = bytes[offset + i];
bytes2[offset2 + i] = b;
}
incrementPosition(length);
io.incrementPosition(length);
return length;
} else {
var bs = readBytes(length);
io.writeAll(bs);
return bs.length;
}
}