CharArrayReader

public class CharArrayReader
extends Reader

java.lang.Object
   ↳ java.io.Reader
     ↳ java.io.CharArrayReader


This class implements a character buffer that can be used as a character-input stream.

Summary

Fields

protected char[] buf

The character buffer.

protected int count

The index of the end of this buffer.

protected int markedPos

The position of mark in buffer.

protected int pos

The current buffer position.

Inherited fields

Public constructors

CharArrayReader(char[] buf)

Creates a CharArrayReader from the specified array of chars.

CharArrayReader(char[] buf, int offset, int length)

Creates a CharArrayReader from the specified array of chars.

Public methods

void close()

Closes the stream and releases any system resources associated with it.

void mark(int readAheadLimit)

Marks the present position in the stream.

boolean markSupported()

Tells whether this stream supports the mark() operation, which it does.

int read()

Reads a single character.

int read(char[] cbuf, int off, int len)

Reads characters into a portion of an array.

int read(CharBuffer target)

Attempts to read characters into the specified character buffer.

boolean ready()

Tells whether this stream is ready to be read.

void reset()

Resets the stream to the most recent mark, or to the beginning if it has never been marked.

long skip(long n)

Skips characters.

Inherited methods