is new.
java.lang.Objectjava.io.Reader
java.io.StringReader
public class StringReader
A character stream whose source is a string.
| Field Summary |
|---|
| Fields inherited from class java.io. Reader |
|---|
| lock |
| Constructor Summary | |
|---|---|
StringReader
(
String
Creates
|
|
| Method Summary | |
|---|---|
| void |
close
()
Closes
stream and releases any system resources associated with it.
|
| void |
mark
(int readAheadLimit)
Marks
|
| boolean |
markSupported
()
Tells
|
| int |
read
()
Reads
|
| int |
read
(char[] cbuf, int off, int len)
Reads
|
| boolean |
ready
()
Tells
|
| void |
reset
()
Resets
|
| long |
skip
(long ns) Skips the specified number of characters in the stream. |
| Methods inherited from class java.io. Reader |
|---|
| read , read |
| Methods inherited from class java.lang. Object |
|---|
| clone , equals , finalize , getClass , hashCode , notify , notifyAll , toString , wait , wait , wait |
| Constructor Detail |
|---|
public StringReader(String s)
Creates
| Method Detail |
|---|
public int read()
throws IOException
Reads
public int read(char[] cbuf,
int off,
int len)
throws IOException
Reads
public long skip(long ns)
throws IOException
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.
public boolean ready()
throws IOException
Tells
public boolean markSupported()
Tells
public void mark(int readAheadLimit)
throws IOException
Marks
public void reset()
throws IOException
Resets
public void close()
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.