public class SeekableStringReader extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
SeekableStringReader.StringContext
Extract a piece of context around the current cursor (if you set cursor to -1)
or around a given position in the string (if you set cursor>=0).
|
| Constructor and Description |
|---|
SeekableStringReader(SeekableStringReader parent)
Make a nested reader with its own cursor and bookmark.
|
SeekableStringReader(String str) |
| Modifier and Type | Method and Description |
|---|---|
int |
bookmark()
Return a bookmark to rewind to later.
|
void |
close() |
SeekableStringReader.StringContext |
context(int crsr,
int width) |
void |
flipBack(int bookmark)
Flip back to previously set bookmark.
|
boolean |
hasMore()
Is tehre more to read?
|
char |
peek()
What is the next character?
|
String |
peek(int count)
What are the next characters that will be read?
|
char |
read()
Read a single character.
|
String |
read(int count)
Read a number of characters.
|
String |
readUntil(char sentinel)
Read everything until one the sentinel, which must exist in the string.
|
String |
readUntil(String sentinels)
Read everything until one of the sentinel(s), which must exist in the string.
|
String |
readWhile(String accepted)
Read everything as long as the char occurs in the accepted characters.
|
String |
rest()
Returns the rest of the data until the end.
|
void |
rewind(int count)
Rewind a number of characters.
|
void |
skipWhitespace()
Read away any whitespace.
|
void |
sync(SeekableStringReader inner)
Sync the position and bookmark with the current position in another reader.
|
public SeekableStringReader(String str)
public SeekableStringReader(SeekableStringReader parent)
public boolean hasMore()
public char peek()
public String peek(int count)
public char read()
public String read(int count)
public String readUntil(char sentinel)
public String readUntil(String sentinels)
public String readWhile(String accepted)
public void skipWhitespace()
public String rest()
public void rewind(int count)
public int bookmark()
public void flipBack(int bookmark)
public void sync(SeekableStringReader inner)
public SeekableStringReader.StringContext context(int crsr, int width)
public void close()
Copyright © 2017. All Rights Reserved.