| java.lang.Object java.io.Reader java.io.CharArrayReader
CharArrayReader | public class CharArrayReader extends Reader (Code) | | This class implements a character buffer that can be used as a
character-input stream.
author: Herb Jellinek version: 1.15, 02/02/00 since: JDK1.1 |
Field Summary | |
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. |
Constructor Summary | |
public | CharArrayReader(char buf) Create an CharArrayReader from the specified array of chars. | public | CharArrayReader(char buf, int offset, int length) Create an CharArrayReader from the specified array of chars. |
Method Summary | |
public void | close() Close the stream. | public void | mark(int readAheadLimit) Mark the present position in the stream. | public boolean | markSupported() Tell whether this stream supports the mark() operation, which it does. | public int | read() Read a single character. | public int | read(char b, int off, int len) Read characters into a portion of an array. | public boolean | ready() Tell whether this stream is ready to be read. | public void | reset() Reset the stream to the most recent mark, or to the beginning if it has
never been marked. | public long | skip(long n) Skip characters. |
buf | protected char buf(Code) | | The character buffer.
|
count | protected int count(Code) | | The index of the end of this buffer. There is not valid
data at or beyond this index.
|
markedPos | protected int markedPos(Code) | | The position of mark in buffer.
|
pos | protected int pos(Code) | | The current buffer position.
|
CharArrayReader | public CharArrayReader(char buf)(Code) | | Create an CharArrayReader from the specified array of chars.
Parameters: buf - Input buffer (not copied) |
CharArrayReader | public CharArrayReader(char buf, int offset, int length)(Code) | | Create an CharArrayReader from the specified array of chars.
Parameters: buf - Input buffer (not copied) Parameters: offset - Offset of the first char to read Parameters: length - Number of chars to read |
close | public void close()(Code) | | Close the stream.
|
mark | public void mark(int readAheadLimit) throws IOException(Code) | | Mark the present position in the stream. Subsequent calls to reset()
will reposition the stream to this point.
Parameters: readAheadLimit - Limit on the number of characters that may beread while still preserving the mark. Becausethe stream's input comes from a character array,there is no actual limit; hence this argument isignored. exception: IOException - If an I/O error occurs |
markSupported | public boolean markSupported()(Code) | | Tell whether this stream supports the mark() operation, which it does.
|
read | public int read(char b, int off, int len) throws IOException(Code) | | Read characters into a portion of an array.
Parameters: b - Destination buffer Parameters: off - Offset at which to start storing characters Parameters: len - Maximum number of characters to read The actual number of characters read, or -1 ifthe end of the stream has been reached exception: IOException - If an I/O error occurs |
ready | public boolean ready() throws IOException(Code) | | Tell whether this stream is ready to be read. Character-array readers
are always ready to be read.
exception: IOException - If an I/O error occurs |
reset | public void reset() throws IOException(Code) | | Reset the stream to the most recent mark, or to the beginning if it has
never been marked.
exception: IOException - If an I/O error occurs |
skip | public long skip(long n) throws IOException(Code) | | Skip characters.
Parameters: n - The number of characters to skip The number of characters actually skipped exception: IOException - If an I/O error occurs |
|
|