|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectReader
CharSequenceReader
public final class CharSequenceReader
This class allows any CharSequence
to be used as
a reader.
Field Summary |
---|
Fields inherited from class Reader |
---|
lock |
Constructor Summary | |
---|---|
CharSequenceReader()
Creates a new character sequence reader for which the character sequence input is not set. |
Method Summary | |
---|---|
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()
Resets the internal state of this object to its default values. |
CharSequenceReader |
setInput(CharSequence charSequence)
Sets the character sequence to use for reading. |
Methods inherited from class Reader |
---|
mark, markSupported, read, read, skip |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CharSequenceReader()
setInput(java.lang.CharSequence)
Method Detail |
---|
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.
close
in interface Closeable
close
in class Reader
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 read
IOException
- if an I/O error occurs.public void read(Appendable dest) throws IOException
dest
- the destination buffer.
IOException
- if an I/O error occurs.public void reset()
Reusable
reset
in interface Reusable
reset
in class Reader
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |