I am writing a simple chat in Java and I want to check if there is any data waiting on BufferedReader. I read about NIO, but I did not quite understand this. Here is my code:
public void Send(String data)
{
out.println(data);
}
public String Recv()
{
if (dataIncomming)
{
try {
return in.readLine();
} catch (IOException e) {
System.err.println("Send: Error on BufferedReader.readLine() - IOException");
}
}
else return "";
}
I do not know what to fill in dataIncomming...
source
share