| |
|
| java.lang.Object java.io.Reader java.io.StringReader
StringReader | public class StringReader extends Reader (Code) | | A character stream whose source is a string.
version: 1.32, 07/05/05 author: Mark Reinhold since: JDK1.1 |
Method Summary | |
public void | close() Closes the stream and releases any system resources associated with
it. | public void | mark(int readAheadLimit) Marks the present position in the stream. | public boolean | markSupported() Tells whether this stream supports the mark() operation, which it does. | public int | read() Reads a single character. | public int | read(char cbuf, int off, int len) Reads characters into a portion of an array. | public boolean | ready() Tells whether this stream is ready to be read. | public void | reset() Resets the stream to the most recent mark, or to the beginning of the
string if it has never been marked. | public long | skip(long ns) Skips the specified number of characters in the stream. |
StringReader | public StringReader(String s)(Code) | | Creates a new string reader.
Parameters: s - String providing the character stream. |
close | public void close()(Code) | | Closes the stream and releases any system resources associated with
it. Once the stream has been closed, further read(),
ready(), mark(), or reset() invocations will throw an IOException.
Closing a previously closed stream has no effect.
|
mark | public void mark(int readAheadLimit) throws IOException(Code) | | Marks 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 string, thereis no actual limit, so this argument must notbe negative, but is otherwise ignored. exception: IllegalArgumentException - If readAheadLimit is < 0 exception: IOException - If an I/O error occurs |
markSupported | public boolean markSupported()(Code) | | Tells whether this stream supports the mark() operation, which it does.
|
read | public int read() throws IOException(Code) | | Reads a single character.
The character read, or -1 if the end of the stream has beenreached exception: IOException - If an I/O error occurs |
read | public int read(char cbuf, int off, int len) throws IOException(Code) | | Reads characters into a portion of an array.
Parameters: cbuf - Destination buffer Parameters: off - Offset at which to start writing characters Parameters: len - Maximum number of characters to read The number of characters read, or -1 if the end of thestream has been reached exception: IOException - If an I/O error occurs |
ready | public boolean ready() throws IOException(Code) | | Tells whether this stream is ready to be read.
True if the next read() is guaranteed not to block for input exception: IOException - If the stream is closed |
reset | public void reset() throws IOException(Code) | | Resets the stream to the most recent mark, or to the beginning of the
string if it has never been marked.
exception: IOException - If an I/O error occurs |
skip | public long skip(long ns) throws IOException(Code) | | Skips the specified number of characters in the stream. Returns
the number of characters that were skipped.
The ns parameter may be negative, even though the
skip method of the
Reader superclass throws
an exception in this case. Negative values of ns cause the
stream to skip backwards. Negative return values indicate a skip
backwards. It is not possible to skip backwards past the beginning of
the string.
If the entire string has been read or skipped, then this method has
no effect and always returns 0.
exception: IOException - If an I/O error occurs |
|
|
|