docs: private static int fill(char[] buf, Reader r) throws IOException {
      int offset = 0;
      int read = 0;
      do {
        read = r.read(buf, offset, buf.length - offset);
        if (read > 0) offset += read;
      } while (offset < buf.length && read >= 0);
      return offset;
    }