code: private boolean fillBuffer(int minimum) throws IOException {
      char[] buffer = this.buffer;
  
      // Before clobbering the old characters, update where buffer starts
      // Using locals here saves ~2%.
      int line = bufferStartLine;
      int column = bufferStartColumn;
      for (int i = 0, p = pos; i < p; i++) {
        if (buffer[i] == '\n') {
          line++;
          column = 1;
        } else {
          column++;
        }
      }
      bufferStartLine = line;
      bufferStartColumn = column;
  
      if (limit != pos) {
        limit -= pos;
        System.arraycopy(buffer, pos, buffer, 0, limit);
      } else {
        limit = 0;
      }
  
      pos = 0;
      int total;
      while ((total = in.read(buffer, limit, buffer.length - limit)) != -1) {
        limit += total;
  
        // if this is the first read, consume an optional byte order mark (BOM) if it exists
        if (bufferStartLine == 1 && bufferStartColumn == 1 && limit > 0 && buffer[0] == '\ufeff') {
          pos++;
          bufferStartColumn--;
        }
  
        if (limit >= minimum) {
          return true;
        }
      }
      return false;
    }
docs: Returns true once {@code limit - pos >= minimum}. If the data is
  exhausted before that many characters are available, this returns
  false.