public final class CharSequenceReader extends java.io.Reader implements Reusable
This class allows any CharSequence to be used as
a reader.
| Constructor | Description |
|---|---|
CharSequenceReader() |
Creates a new character sequence reader for which the character
sequence input is not set.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
close() |
Closes and
resets this reader for reuse. |
int |
read() |
Reads a single character.
|
void |
read(java.lang.Appendable dest) |
Reads characters into the specified appendable.
|
int |
read(char[] cbuf,
int off,
int len) |
Reads characters into a portion of an array.
|
boolean |
ready() |
Indicates if this stream is ready to be read.
|
void |
reset() |
Resets the internal state of this object to its default values.
|
CharSequenceReader |
setInput(java.lang.CharSequence charSequence) |
Sets the character sequence to use for reading.
|
public CharSequenceReader()
setInput(java.lang.CharSequence)public CharSequenceReader setInput(java.lang.CharSequence charSequence)
public boolean ready()
throws java.io.IOException
ready in class java.io.Readertrue if this reader has remaining characters to
read; false otherwise.java.io.IOException - if an I/O error occurs.public void close()
resets this reader for reuse.close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerpublic int read()
throws java.io.IOException
-1
is returned if the end of the character sequence input has been reached.read in class java.io.Readerjava.io.IOException - if an I/O error occurs (e.g. incomplete
character sequence being read).public int read(char[] cbuf,
int off,
int len)
throws java.io.IOException
read in class java.io.Readercbuf - the destination buffer.off - the offset at which to start storing characters.len - the maximum number of characters to readjava.io.IOException - if an I/O error occurs.public void read(java.lang.Appendable dest)
throws java.io.IOException
dest - the destination buffer.java.io.IOException - if an I/O error occurs.Copyright © 2005 - 2009 Javolution.