public String readLine () throws IOException {

		StringBuffer buf  = new StringBuffer(80);
		boolean endOfLine = false;
		boolean lastWasCr = false;
		int bytesRead = 0;
		do {
			int c = read();
			switch (c) {

			    case -1:
					endOfLine = true;
					break;

				case '\r':
					lastWasCr = true;
					bytesRead++;
					break;

				case '\n':
					bytesRead++;
					if (lastWasCr) {
						endOfLine = true;
					} else {
						buf.append((char)'\n');
					}
					break;

				default:
					bytesRead++;
					if (lastWasCr) {
						buf.append((char)'\r');
						lastWasCr = false;
					}
					buf.append((char)c);
					break;
			}

		} while (!endOfLine);
		
		if (bytesRead == 0) {
			return (null);
		}
		
		incrBytesRead(bytesRead);
		String line = buf.toString();
		if (line.equals(".")) {
			return (null);
		} else {
			return (line);
		}
	}