public final class CharacterReader extends Object
| Constructor and Description |
|---|
CharacterReader(Reader input) |
CharacterReader(Reader input,
int sz) |
CharacterReader(String input) |
| Modifier and Type | Method and Description |
|---|---|
void |
advance()
Moves the current position by one.
|
void |
close() |
int |
columnNumber()
Get the current column number (that the reader has consumed to).
|
String |
consumeTo(char c)
Reads characters up to the specific char.
|
String |
consumeToAny(char... chars)
Read characters until the first of any delimiters is found.
|
char |
current()
Get the char at the current position.
|
boolean |
isEmpty()
Tests if all the content has been read.
|
boolean |
isTrackNewlines()
Check if the tracking of newlines is enabled.
|
int |
lineNumber()
Get the current line number (that the reader has consumed to).
|
int |
pos()
Gets the position currently read to in the content.
|
String |
toString() |
void |
trackNewlines(boolean track)
Enables or disables line number tracking.
|
public CharacterReader(Reader input, int sz)
public CharacterReader(Reader input)
public CharacterReader(String input)
public void close()
public int pos()
public void trackNewlines(boolean track)
track - set tracking on|offpublic boolean isTrackNewlines()
public int lineNumber()
trackNewlines(boolean)public int columnNumber()
trackNewlines(boolean)public boolean isEmpty()
public char current()
public void advance()
public String consumeTo(char c)
c - the delimiterpublic String consumeToAny(char... chars)
chars - delimiters to scan forCopyright © 2009–2022 Jonathan Hedley. All rights reserved.