readExact method

Future<void> readExact(
  1. ReadBuf dst
)

Fills dst completely or throws UnexpectedEof.

Implementation

Future<void> readExact(ReadBuf dst) async {
  while (dst.hasRemaining) {
    final result = await readInto(dst);
    if (result.bytes == 0) {
      throw UnexpectedEof(dst.capacity, dst.filled);
    }
  }
}