CharArrayReader ready() in Java

ready(): This method is available in the java.io.CharArrayReader class of Java.

Syntax:

boolean java.io.CharArrayReader.ready() throws IOException

This method tells whether this stream is ready to be read. Character-array readers are always ready to be read.

Parameters: NA

Returns: True if the next read() is guaranteed not to block for input, false otherwise.

Exceptions: NA

Approach

Java

import java.io.CharArrayReader;
import java.io.IOException;

public class CharArrayReaderready {

    public static void main(String[] args) throws IOException {
        char buf[] = { 'a', 'b', 'c', 'd' };
        CharArrayReader charArrayReader =
new CharArrayReader(buf);

        System.out.println(charArrayReader.ready());
        charArrayReader.close();

    }
}

Output:

true


No comments:

Post a Comment