![]() |
VOOZH | about |
The CharArrayReader class in Java is part of the java.io package and allows you to read characters from a character array (char[]) as a stream. It extends the Reader class and is mainly used when you want to treat a character array as an input source, similar to reading from files or other streams.
public class CharArrayReader extends Reader
CharArrayReader provides two constructors
Reads a single character from the input stream and returns it as an integer
J A V A
Reads characters into a portion of the specified array from the given offset for a given length.
HEL
Checks whether the stream is ready to be read. Since it’s memory-based, it’s always ready unless closed.
Reader is ready to read.
Skips the specified number of characters in the stream.
C D E
Marks the current position in the stream so it can be returned to later using reset().
XYZ After reset: Y Z P Q
Returns true indicating that the mark() and reset() methods are supported.
markSupported(): true
Resets the stream to the most recently marked position or to the beginning if no mark was set.
HEL After reset: E L L O
Closes the reader and releases resources.
Reader closed successfully.