validateRange method
Validates the given start
and length
range components and return them
(or the default ones if null). Throws an exception if the range is not
valid.
Implementation
List<int> validateRange(int? start, int? length) {
start = max(0, start ?? 0);
length = min(this.length, length ?? this.length - start);
// if (start < 0 ||
// start >= this.length ||
// length < 1 ||
// length - 1 > this.length - start) {
// throw DataStreamException.outOfRange(start, length);
// }
return [start, length];
}