public class CharSequenceReader extends Reader implements Serializable
Reader implementation that can read from String, StringBuffer, StringBuilder, CharBuffer or GString.
Note: Supports mark(int) and reset().
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.
| Constructor and description | 
|---|
| CharSequenceReader(CharSequence charSequence)Construct a new instance with the specified character sequence. | 
| Type Params | Return Type | Name and description | 
|---|---|---|
|  | public void | close()Close resets the reader back to the start and removes any marked position. | 
|  | public void | mark(int readAheadLimit)Mark the current position. | 
|  | public boolean | markSupported()Mark is supported (returns true). | 
|  | public int | read()Read a single character. | 
|  | public int | read(char[] array, int offset, int length)Read the specified number of characters into the array. | 
|  | public void | reset()Reset the reader to the last marked position (or the beginning if mark has not been called). | 
|  | public long | skip(long n)Skip the specified number of characters. | 
|  | public String | toString()Return a String representation of the underlying character sequence. | 
Construct a new instance with the specified character sequence.
charSequence -  The character sequence, may be nullClose resets the reader back to the start and removes any marked position.
Mark the current position.
readAheadLimit -  ignoredMark is supported (returns true).
trueRead a single character.
Read the specified number of characters into the array.
array -  The array to store the characters inoffset -  The starting position in the array to storelength -  The maximum number of characters to readReset the reader to the last marked position (or the beginning if mark has not been called).
Skip the specified number of characters.
n -  The number of characters to skipCopyright © 2003-2025 The Apache Software Foundation. All rights reserved.