What's wrong with Java readline()?
I just updated to OS X 10.6.8 and installed the Java update 1.6.0_26-b03-384.
It appears that BufferedReader.readLine() is broken for reading input lines from the console. readLine() does not terminate with a newline.
This is pretty basic. What's up?
import java.io.*;
/**
This class demonstrates how to read a line of text from the keyboard
*/
class ReadLine{
public static void main(String[] args) throws IOException{
String CurLine = ""; // Line read from standard in
System.out.println("Enter a line of text (type 'quit' to exit): ");
InputStreamReader converter = new InputStreamReader(System.in);
BufferedReader in = new BufferedReader(converter);
while (!(CurLine.equals("quit"))){
CurLine = in.readLine();
if (!(CurLine.equals("quit"))){
System.out.println("You typed: " + CurLine);
}
}
}
}