I'm writing a simple chat in Java, and I want to check if there is some data waiting on BufferedReader. I've read about NIO, but I didn't completely understand it. Here is some of 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 don't know what to fill into dataIncomming ...

Edit
Report