Is there a way to check if in BufferedReader
object is something to read? Something like C++ cin.peek()
. Thanks.
You can try the "boolean ready()" method. From the Java 6 API doc: "A buffered character stream is ready if the buffer is not empty, or if the underlying character stream is ready."
BufferedReader r = new BufferedReader(reader);
if(r.ready())
{
r.read();
}