I'm running a thread and everytime it runs, It should be checking to see if there is a new line to read from the BufferedReader
although, it gets stuck waiting for a line to exist, thus halting the entire code.
if((inputLine = bufferedReader.readLine()) != null){
System.out.println(inputLine);
JOptionPane.showMessageDialog(null, inputLine);
}
Is there a way to better check if there is text in a BufferedReader
to be read?
BufferedReader#ready()
docs.oracle.com/javase/6/docs/api/java/io/…? – Hoebartready()
would answer that need.ready()
would tell him whether there's something in the buffer; it won't tell him whether there's a full line to read.readLine()
will still enter a waiting state, won't it? – Domesday