Skip to main content

CharArrayReader class in java is a class in java programming language. Inside of this class exists 8 public methods. Declaration of this class as follows.

public class 

CharArrayReader public method

There are following useful methods which is define the inside of class.

void close() It closes the stream and releases any system resources associated with it.
void mark(int readAheadLimit) It marks the present position in the stream.
boolean markSupported() It tells whether this stream supports the mark() operation, which it does.
int read() It reads a single character.
int read(char[] b, int off, int len) It reads characters into a portion of an array.
boolean ready() It tells whether this stream is ready to be read.
void reset() It resets the stream to the most recent mark, or to the beginning if it has never been marked.
long skip(long n) It skips characters.

This reference is belong to javadoc

Public Constructors

There is 2 types of public constructor is defined inside the class, Whose syntax as follows.


Example of[]).

// java program for CharArrayReader example 
public class Example
    public static void main(String[] args) throws Exception
        char[] charArr = {
            'h' , 'a' , 'p' , 'p' , 'y'
        CharArrayReader reader = new CharArrayReader(charArr);
        // Started read with the first character
        int info =;
        // Iterate the CharArrayReader value
        while (info != -1)
            // info is form of byte
            // (char)info is printing a character value
            System.out.print((char) info);
            info =;
Instance of class in java


Please share your knowledge to improve code and content standard. Also submit your doubts, and test case. We improve by your feedback. We will try to resolve your query as soon as possible.

New Comment