Reader implementation that can read from String, StringBuffer,
StringBuilder, CharBuffer or GString.Note
This class is mostly a copy from Commons IO and is intended for internal Groovy usage only. It may be deprecated and removed from Groovy at a faster pace than other classes. If you need this functionality in your Groovy programs, we recommend using the Commons IO equivalent directly.
| Modifier and Type | Field and Description |
|---|---|
| private final CharSequence | |
| private static final int | |
| private int | |
| private int | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| public | CharSequenceReader(final CharSequence
The character sequence, may be charSequence)nullConstruct a new instance with the specified character sequence. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Implements abstract java. Implements java. |
| public void | |
| public boolean | Returns: trueOverrides java. |
| public int | Returns: the next character from the character sequence or -1 if the end has been reached.Overrides java. |
| public int | Returns: The number of characters read or -1 if there are no moreThe array to store the characters in array, final int The starting position in the array to store offset, final int The maximum number of characters to read length)Implements abstract java. |
| public void | reset()
Overrides java. |
| public long | Returns: The actual number of characters skippedThe number of characters to skip n)Overrides java. |
| public String | Returns: The contents of the character sequenceOverrides java. |
| charSequence | back to summary |
|---|---|
| private final CharSequence charSequence | |
| EOF | back to summary |
|---|---|
| private static final int EOF | |
| idx | back to summary |
|---|---|
| private int idx | |
| mark | back to summary |
|---|---|
| private int mark | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| CharSequenceReader | back to summary |
|---|---|
| public CharSequenceReader(final CharSequence charSequence) Construct a new instance with the specified character sequence.
| |
| close | back to summary |
|---|---|
| public void close() Implements abstract java. Implements java. Close resets the reader back to the start and removes any marked position.
| |
| mark | back to summary |
|---|---|
| public void mark(final int readAheadLimit) Overrides java. Mark the current position.
| |
| markSupported | back to summary |
|---|---|
| public boolean markSupported() Overrides java. Mark is supported (returns true).
| |
| read | back to summary |
|---|---|
| public int read() Overrides java. Read a single character.
| |
| read | back to summary |
|---|---|
| public int read(final char[] array, final int offset, final int length) Implements abstract java. Read the sepcified number of characters into the array.
| |
| reset | back to summary |
|---|---|
| public void reset() Overrides java. Reset the reader to the last marked position (or the beginning if mark has not been called).
| |
| skip | back to summary |
|---|---|
| public long skip(final long n) Overrides java. Skip the specified number of characters.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Return a String representation of the underlying character sequence. | |