public class CharSequenceReader
extends java.io.Reader
implements java.io.Serializable
Reader implementation that can read from String, StringBuffer,
StringBuilder or CharBuffer.
| Modifier and Type | Field and Description |
|---|---|
private java.lang.CharSequence |
charSequence |
private int |
idx |
private int |
mark |
private static long |
serialVersionUID |
| Constructor and Description |
|---|
CharSequenceReader(java.lang.CharSequence charSequence)
Construct a new instance with the specified character sequence.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Close resets the file back to the start and removes any marked position.
|
void |
mark(int readAheadLimit)
Mark the current position.
|
boolean |
markSupported()
Mark is supported (returns true).
|
int |
read()
Read a single character.
|
int |
read(char[] array,
int offset,
int length)
Read the sepcified number of characters into the array.
|
void |
reset()
Reset the reader to the last marked position (or the beginning if
mark has not been called).
|
long |
skip(long n)
Skip the specified number of characters.
|
java.lang.String |
toString()
Return a String representation of the underlying
character sequence.
|
private static final long serialVersionUID
private final java.lang.CharSequence charSequence
private int idx
private int mark
public CharSequenceReader(java.lang.CharSequence charSequence)
charSequence - The character sequence, may be nullpublic void close()
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.Readerpublic void mark(int readAheadLimit)
mark in class java.io.ReaderreadAheadLimit - ignoredpublic boolean markSupported()
markSupported in class java.io.Readertruepublic int read()
read in class java.io.Readerpublic int read(char[] array,
int offset,
int length)
read in class java.io.Readerarray - The array to store the characters inoffset - The starting position in the array to storelength - The maximum number of characters to readpublic void reset()
reset in class java.io.Readerpublic long skip(long n)
skip in class java.io.Readern - The number of characters to skippublic java.lang.String toString()
toString in class java.lang.ObjectCopyright (c) 2002-2016 Apache Software Foundation