Method from java.io.Reader Detail: |
abstract public void close() throws IOException
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 {
throw new IOException("mark() not supported");
}
Marks the present position in the stream. Subsequent calls to reset()
will attempt to reposition the stream to this point. Not all
character-input streams support the mark() operation. |
public boolean markSupported() {
return false;
}
Tells whether this stream supports the mark() operation. The default
implementation always returns false. Subclasses should override this
method. |
public int read() throws IOException {
char cb[] = new char[1];
if (read(cb, 0, 1) == -1)
return -1;
else
return cb[0];
}
|
public int read(CharBuffer target) throws IOException {
int len = target.remaining();
char[] cbuf = new char[len];
int n = read(cbuf, 0, len);
if (n > 0)
target.put(cbuf, 0, n);
return n;
}
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. |
public int read(char[] cbuf) throws IOException {
return read(cbuf, 0, cbuf.length);
}
Reads characters into an array. This method will block until some input
is available, an I/O error occurs, or the end of the stream is reached. |
abstract public int read(char[] cbuf,
int off,
int len) throws IOException
Reads characters into a portion of an array. This method will block
until some input is available, an I/O error occurs, or the end of the
stream is reached. |
public boolean ready() throws IOException {
return false;
}
Tells whether this stream is ready to be read. |
public void reset() throws IOException {
throw new IOException("reset() not supported");
}
Resets the stream. If the stream has been marked, then attempt to
reposition it at the mark. If the stream has not been marked, then
attempt to reset it in some way appropriate to the particular stream,
for example by repositioning it to its starting point. Not all
character-input streams support the reset() operation, and some support
reset() without supporting mark(). |
public long skip(long n) throws IOException {
if (n < 0L)
throw new IllegalArgumentException("skip value is negative");
int nn = (int) Math.min(n, maxSkipBufferSize);
synchronized (lock) {
if ((skipBuffer == null) || (skipBuffer.length < nn))
skipBuffer = new char[nn];
long r = n;
while (r > 0) {
int nc = read(skipBuffer, 0, (int)Math.min(r, nn));
if (nc == -1)
break;
r -= nc;
}
return n - r;
}
}
Skips characters. This method will block until some characters are
available, an I/O error occurs, or the end of the stream is reached. |