public class StringReader extends Object
| Constructor and Description |
|---|
StringReader(String source) |
| Modifier and Type | Method and Description |
|---|---|
char |
advance()
Gets the character at the current index, and increments the index.
|
char |
advance(int offset)
Gets the character at the current index and offset, and increments the index by the offset.
|
boolean |
available()
Establishes whether there is a character to immediately read.
|
int |
index()
Gets the index of the character currently being read.
|
int |
length()
Gets the length of the source.
|
char |
peek()
Gets the character at the current index.
|
char |
peek(int offset)
Gets the character at the current index and offset.
|
boolean |
readable(int offset)
Establishes whether there is a character to read, with the given offset.
|
int |
remaining()
Gets the count of the remaining characters to be read.
|
void |
skip(int length)
Advances the index by the given length.
|
String |
substring(int start,
int end)
Gets a substring of the source.
|
public StringReader(String source)
public int length()
public int remaining()
public int index()
public boolean readable(int offset)
offset - How many characters aheadtrue if there is a character to read;
false otherwisepublic boolean available()
true if there is a character to be read;
false otherwisepublic void skip(int length)
length - How much to advance bypublic char peek()
public char peek(int offset)
offset - The offset of the characterpublic char advance()
public char advance(int offset)
offset - The offset of the characterpublic String substring(int start, int end)
start - The start indexend - The end indexString.substring(int, int)