public final class CharSequenceReader extends Reader
This class allows any CharSequence
to be used as
a reader.
Constructor and Description |
---|
CharSequenceReader()
Creates a new character sequence reader for which the character
sequence input is not set.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes and
resets this reader for reuse. |
int |
read()
Reads a single character.
|
void |
read(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() |
CharSequenceReader |
setInput(CharSequence charSequence)
Sets the character sequence to use for reading.
|
public CharSequenceReader()
setInput(java.lang.CharSequence)
public CharSequenceReader setInput(CharSequence charSequence)
charSequence
- the character sequence to be read.IllegalStateException
- if this reader is being reused and
it has not been closed
or reset
.public boolean ready() throws IOException
ready
in class Reader
true
if this reader has remaining characters to
read; false
otherwise.IOException
- if an I/O error occurs.public void close()
resets
this reader for reuse.public int read() throws IOException
-1
is returned if the end of the character sequence input has been reached.read
in class Reader
IOException
- if an I/O error occurs (e.g. incomplete
character sequence being read).public int read(char[] cbuf, int off, int len) throws IOException
read
in class Reader
cbuf
- the destination buffer.off
- the offset at which to start storing characters.len
- the maximum number of characters to readIOException
- if an I/O error occurs.public void read(Appendable dest) throws IOException
dest
- the destination buffer.IOException
- if an I/O error occurs.Copyright © 2005-2013 Javolution. All Rights Reserved.