Class: java.io.StringReader
- public class StringReader
- extends Reader
A character stream whose source is a string.
Methods
-
StringReadertop
public StringReader(String s)Create a new string reader. -
closetop
public void close()Close the stream. -
marktop
public void mark(int readAheadLimit) throws IOExceptionMark the present position in the stream. Subsequent calls to reset() will reposition the stream to this point. -
markSupportedtop
public boolean markSupported()Tell whether this stream supports the mark() operation, which it does.- Override hierarchy:
- markSupported from Reader
-
readtop
public int read() throws IOExceptionRead a single character. -
readtop
public int read(char[] cbuf, int off, int len) throws IOExceptionRead characters into a portion of an array. -
readytop
public boolean ready() throws IOExceptionTell whether this stream is ready to be read. -
resettop
public void reset() throws IOExceptionReset the stream to the most recent mark, or to the beginning of the string if it has never been marked. -
skiptop
public long skip(long ns) throws IOExceptionSkips the specified number of characters in the stream. Returns the number of characters that were skipped.The
nsparameter may be negative, even though theskipmethod of the java.io.Reader superclass throws an exception in this case. Negative values ofnscause 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.
