code: public final String getNextLine() throws IOException {
      String str = null;
      if (buf_end - buf_pos <= 0) {
        if (fillBuffer() < 0) {
          return null;
        }
      }
      int lineend = -1;
      for (int i = buf_pos; i < buf_end; i++) {
        if (buffer[i] == '\n') {
          lineend = i;
          break;
        }
        // check for only '\r' as line end
        if ((i - buf_pos > 0) && buffer[i - 1] == '\r') {
          lineend = i - 1;
          break;
        }
      }
      if (lineend < 0) {
        StringBuilder input = new StringBuilder(256);
        int c;
        int lastC = 0;
        while (((c = read()) != -1) && (c != '\n') && (lastC != '\r')) {
          input.append((char) c);
          lastC = c;
        }
        if ((c == -1) && (input.length() == 0)) {
          return null;
        }
        return input.toString();
      }
      if (lineend > 0 && buffer[lineend] == '\n' && buffer[lineend - 1] == '\r') {
        str = new String(buffer, buf_pos, lineend - buf_pos - 1);
      } else {
        str = new String(buffer, buf_pos, lineend - buf_pos);
      }
      buf_pos = lineend + 1;
      return str;
    }
docs: Returns the next line from the file. In case no data could be loaded (generally as the end of
  the file was reached) null is returned.
  
  @return The next string on the file or null in case the end of the file was reached.