|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.meyling.principia.io.Input
This class provides convenient methods for parsing input. TODO offer input stream constructor
| Field Summary | |
private static char |
CR
char marking end of input line |
private static char |
EOF
char marking end of data |
private StringBuffer |
line
current line |
private int |
lineNumber
current line number |
private static String |
MARKER
string for marking current reading position |
private int |
position
current reading position |
private StringBuffer |
source
holds the data |
| Constructor Summary | |
Input(String source)
Constructor using String source. |
|
Input(StringBuffer source)
Constructor using StringBuffer source. |
|
| Method Summary | |
char |
getChar()
Reads a single character and does not change the reading position. |
char |
getChar(int i)
Reads a single character and does not change the reading position. |
int |
getLineNumber()
Returns the current line number. |
boolean |
isEmpty()
Is there no data left for reading? |
char |
readChar()
Reads a single character and increments the reading position by one. |
int |
readCounter()
Reads the next positive integer made completly out of digits, leading whitespace is skipped. |
String |
readLetterDigitString()
Reads the next string containing only letters or digits, leading whitespace is skipped. |
String |
readQuoted()
Reads the next quoted string, leading whitespace is skipped. |
String |
showLinePosition()
Show reading position. |
void |
skipWhiteSpace()
Skips white space, beginning from reading position. |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
private static final char EOF
private static final char CR
private static final String MARKER
private final StringBuffer source
private StringBuffer line
private int lineNumber
private int position
| Constructor Detail |
public Input(StringBuffer source)
StringBuffer source.source - data sourceIllegalArgumentException - if argument was
an nullpointerpublic Input(String source)
String source.source - data sourceIllegalArgumentException - if argument was
an nullpointer| Method Detail |
public final char readChar()
Character.MAX_VALUE is returnedpublic final char getChar()
Character.MAX_VALUE is returnedpublic final char getChar(int i)
i - offset from current reading position.Character.MAX_VALUE is returnedpublic final int getLineNumber()
public final void skipWhiteSpace()
public final boolean isEmpty()
public final String readLetterDigitString()
IllegalArgumentException - if no such characters could
be foundpublic final int readCounter()
IllegalArgumentException - if no digits where found or
the number was to big for an int
public final String readQuoted()
throws IllegalArgumentException
IllegalArgumentException - if no correctly quoted
string was foundpublic final String showLinePosition()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||