|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--com.meyling.principia.io.TextInput
This class provides convenient methods for parsing input. TODO offer input stream constructor
| Field Summary | |
private String |
address
address of input, for identifing address |
private int |
column
current column (starting with 0) |
private static char |
CR
char marking end of input line |
private static char |
EOF
char marking end of data |
private int |
lineNumber
current line number (starting with 0) |
private String |
localAddress
local address of input, for identifing address |
private static String |
MARKER
string for marking current reading position |
private int |
position
current reading position |
private StringBuffer |
source
holds the data |
| Constructor Summary | |
TextInput(StringBuffer source,
String address,
String localAddress)
Constructor using StringBuffer source. |
|
TextInput(String source,
String address,
String localAddress)
Constructor using String source. |
|
| Method Summary | |
String |
getAddress()
Get address (or something to identify it) of input source. |
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 |
getColumn()
Returns the current column number. |
String |
getLine()
Returns the current line. |
String |
getLocalAddress()
Get local address (or something to identify it) of input source. |
int |
getMaximumPosition()
Returns the highest position number possible. |
int |
getPosition()
Returns the current position. |
int |
getRow()
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. |
void |
setPosition(int position)
Sets the current position (and indirectly the line number). |
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 int lineNumber
private int column
private int position
private final String address
private final String localAddress
| Constructor Detail |
public TextInput(StringBuffer source,
String address,
String localAddress)
StringBuffer source.source - data sourceaddress - for identifing sourcelocalAddress - source addressIllegalArgumentException - if argument was
an nullpointer
public TextInput(String source,
String address,
String localAddress)
String source.source - data sourceaddress - for identifing sourcelocalAddress - source addressIllegalArgumentException - 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 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 int getRow()
public final int getColumn()
public final String getLine()
public final int getPosition()
public final int getMaximumPosition()
public final void setPosition(int position)
position - set current positionpublic final String getAddress()
public final String getLocalAddress()
public final String showLinePosition()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||