java.io
public class StringReader extends Reader
String
to be read as a character
input stream.
The mark/reset functionality in this class behaves differently than
normal. If no mark has been set, then calling the reset()
method rewinds the read pointer to the beginning of the String
.
UNKNOWN: October 19, 1998.
Constructor Summary | |
---|---|
StringReader(String buffer)
Create a new StringReader that will read chars from the
passed in String . |
Method Summary | |
---|---|
void | close() |
void | mark(int readAheadLimit) |
boolean | markSupported() |
int | read() |
int | read(char[] b, int off, int len) |
boolean | ready()
This method determines if the stream is ready to be read. |
void | reset()
Sets the read position in the stream to the previously
marked position or to 0 (i.e., the beginning of the stream) if the mark
has not already been set. |
long | skip(long n)
This method attempts to skip the requested number of chars in the
input stream. |
StringReader
that will read chars from the
passed in String
. This stream will read from the beginning
to the end of the String
.
Parameters: buffer The String
this stream will read from.
true
, unless
close() has previously been called in which case an IOException is
thrown.
Returns: true
to indicate that this object is ready to be read.
Throws: IOException If the stream is closed.
pos
value by
the specified number of chars. It this would exceed the length of the
buffer, then only enough chars are skipped to position the stream at
the end of the buffer. The actual number of chars skipped is returned.
Parameters: n The requested number of chars to skip
Returns: The actual number of chars skipped.