safeRead<T> function

List<T> safeRead<T>(
  1. BufferPipe<T> pipe,
  2. int ref
)

Implementation

List<T> safeRead<T>(BufferPipe<T> pipe, int ref) {
  if (pipe.length < ref) {
    throw RangeError.range(
      pipe.length,
      ref,
      null,
      'pipe',
      'Unexpected end of buffer',
    );
  }
  return pipe.read(ref);
}