Java IO Tutorial - Java StringReader.ready()








Syntax

StringReader.ready() has the following syntax.

public boolean ready()  throws IOException

Example

In the following code shows how to use StringReader.ready() method.

/*from   ww  w . j  ava2 s .  co m*/
import java.io.IOException;
import java.io.StringReader;
import java.util.Arrays;

public class Main {
  public static void main(String[] argv) throws IOException{
    StringReader stringReader = new StringReader("java2s.com");
    
    System.out.println(stringReader.ready());

    char[] charArray = new char[10];
    stringReader.read(charArray);
    System.out.println(Arrays.toString(charArray));
    
    
    stringReader.close();
  }
}

The code above generates the following result.