Modifier and Type | Field and Description |
---|---|
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. |
Access | Constructor and Description |
---|---|
public | CharArrayReader(char[]
Input buffer (not copied) buf)Creates a CharArrayReader from the specified array of chars. |
public | CharArrayReader(char[]
Input buffer (not copied) buf, int Offset of the first char to read offset, int Number of chars to read length)Creates a CharArrayReader from the specified array of chars. |
Modifier and Type | Method and Description |
---|---|
public void | close()
Implements abstract java. Implements java. Closes the stream and releases any system resources associated with it. |
private void | |
public void | mark(int
Limit on the number of characters that may be
read while still preserving the mark. Because
the stream's input comes from a character array,
there is no actual limit; hence this argument is
ignored. readAheadLimit)Overrides java. Marks the present position in the stream. |
public boolean | markSupported()
Overrides java. Tells whether this stream supports the mark() operation, which it does. |
public int | |
public int | Returns: The number of characters read, or -1 if the end of the stream has been reachedDestination buffer cbuf, int Offset at which to start storing characters off, int Maximum number of characters to read len)Implements abstract java. Reads characters into a portion of an array. |
public int | read(CharBuffer
the buffer to read characters into target)Overrides java. Implements java. Attempts to read characters into the specified character buffer. |
public boolean | |
public void | reset()
Overrides java. Resets the stream to the most recent mark, or to the beginning if it has never been marked. |
public long | Returns: The number of characters actually skippedThe number of characters to skip n)Overrides java. Skips characters. |
buf | back to summary |
---|---|
protected char[] buf The character buffer. |
count | back to summary |
---|---|
protected int count The index of the end of this buffer. There is no valid data at or beyond this index. |
markedPos | back to summary |
---|---|
protected int markedPos The position of mark in buffer. |
pos | back to summary |
---|---|
protected int pos The current buffer position. |
CharArrayReader | back to summary |
---|---|
public CharArrayReader(char[] buf) Creates a CharArrayReader from the specified array of chars.
|
CharArrayReader | back to summary |
---|---|
public CharArrayReader(char[] buf, int offset, int length) Creates a CharArrayReader from the specified array of chars. The resulting reader will start reading at the given
|
close | back to summary |
---|---|
public void close() Implements abstract java. Implements java. Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), ready(), mark(), reset(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect. This method will block while there is another thread blocking on the reader. |
ensureOpen | back to summary |
---|---|
private void ensureOpen() throws IOException Checks to make sure that the stream has not been closed |
mark | back to summary |
---|---|
public void mark(int readAheadLimit) throws IOException Overrides java. Marks the present position in the stream. Subsequent calls to reset() will reposition the stream to this point.
|
markSupported | back to summary |
---|---|
public boolean markSupported() Overrides java. Tells whether this stream supports the mark() operation, which it does.
|
read | back to summary |
---|---|
public int read() throws IOException Overrides java. Reads a single character.
|
read | back to summary |
---|---|
public int read(char[] cbuf, int off, int len) throws IOException Implements abstract java. Reads characters into a portion of an array. If
|
read | back to summary |
---|---|
public int read(CharBuffer target) throws IOException Overrides java. Implements java. Doc from java. Attempts to read characters into the specified character buffer. The buffer is used as a repository of characters as-is: the only changes made are the results of a put operation. No flipping or rewinding of the buffer is performed. If the length of the specified character buffer is zero, then no characters will be read and zero will be returned.
|
ready | back to summary |
---|---|
public boolean ready() throws IOException Overrides java. Tells whether this stream is ready to be read. Character-array readers are always ready to be read.
|
reset | back to summary |
---|---|
public void reset() throws IOException Overrides java. Resets the stream to the most recent mark, or to the beginning if it has never been marked.
|
skip | back to summary |
---|---|
public long skip(long n) throws IOException Overrides java. Skips characters. If the stream is already at its end before this method is invoked, then no characters are skipped and zero is returned. The
|