Method from java.io.CharArrayReader Detail: |
public void close() {
buf = null;
}
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. |
public void mark(int readAheadLimit) throws IOException {
synchronized (lock) {
ensureOpen();
markedPos = pos;
}
}
Marks the present position in the stream. Subsequent calls to reset()
will reposition the stream to this point. |
public boolean markSupported() {
return true;
}
Tells whether this stream supports the mark() operation, which it does. |
public int read() throws IOException {
synchronized (lock) {
ensureOpen();
if (pos >= count)
return -1;
else
return buf[pos++];
}
}
Reads a single character. |
public int read(char[] b,
int off,
int len) throws IOException {
synchronized (lock) {
ensureOpen();
if ((off < 0) || (off > b.length) || (len < 0) ||
((off + len) > b.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
if (pos >= count) {
return -1;
}
if (pos + len > count) {
len = count - pos;
}
if (len < = 0) {
return 0;
}
System.arraycopy(buf, pos, b, off, len);
pos += len;
return len;
}
}
Reads characters into a portion of an array. |
public boolean ready() throws IOException {
synchronized (lock) {
ensureOpen();
return (count - pos) > 0;
}
}
Tells whether this stream is ready to be read. Character-array readers
are always ready to be read. |
public void reset() throws IOException {
synchronized (lock) {
ensureOpen();
pos = markedPos;
}
}
Resets the stream to the most recent mark, or to the beginning if it has
never been marked. |
public long skip(long n) throws IOException {
synchronized (lock) {
ensureOpen();
if (pos + n > count) {
n = count - pos;
}
if (n < 0) {
return 0;
}
pos += n;
return n;
}
}
Skips characters. Returns the number of characters that were skipped.
The n parameter may be negative, even though the
skip method of the Reader superclass throws
an exception in this case. If n is negative, then
this method does nothing and returns 0 . |