protected String readLine() throws IOException {
		if (nextLine != null) {
			String nl = nextLine;
			nextLine = null;
			return nl;
		}

		nextLine = reader.readLine(); // Read a line (only if needed)

		// Remove trailing '\r'
		if ((nextLine != null) && (nextLine.length() > 0) && nextLine.charAt(nextLine.length() - 1) == '\r') nextLine = nextLine.substring(0, nextLine.length() - 1);

		if (nextLine != null) lineNum++;
		return nextLine;
	}