Java FilterReader.ready()
Syntax
FilterReader.ready() has the following syntax.
public boolean ready() throws IOException
Example
In the following code shows how to use FilterReader.ready() method.
// ww w . j av a 2 s .com
import java.io.FilterReader;
import java.io.Reader;
import java.io.StringReader;
public class Main {
public static void main(String[] args) throws Exception {
Reader r = new StringReader("ABCDEF");
// create new filter reader
FilterReader fr = new FilterReader(r) {
};
// true if the filter reader is ready to be read
boolean bool = fr.ready();
// prints
System.out.println("Ready to read? " + bool);
}
}
The code above generates the following result.
Home »
Java Tutorial »
java.io »
Java Tutorial »
java.io »