public class CfgFileParser
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected static char |
CLOSE_BRACKET_CHAR |
protected boolean |
commaSepFlag |
protected java.lang.String |
errorMessage |
protected CfgFileTokenizer |
inTokens |
protected static char |
OPEN_BRACKET_CHAR |
protected boolean |
wordSlashFlag |
Constructor and Description |
---|
CfgFileParser(java.io.Reader rdr)
Creates parser object which reads from the given stream.
|
CfgFileParser(java.io.Reader rdr,
boolean wordSlashFlag)
Creates parser object which reads from the given stream.
|
CfgFileParser(java.io.Reader rdr,
boolean wordSlashFlag,
boolean commaSepFlag)
Creates parser object which reads from the given stream.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getErrorMessage()
Returns message string for last error (or 'No error' if none).
|
protected java.lang.Number |
parseEqualsNumber()
Parses "equals" sign ('=') followed by a number.
|
protected java.lang.String |
parseEqualsString()
Parses "equals" sign ('=') followed by a string.
|
void |
resetInput(java.io.Reader rdr)
Resets the input stream for this parser.
|
protected void |
setDupFieldMsg(java.lang.String fieldName)
Builds "Duplicate entry for field" error message with given string.
|
protected void |
setIllegalCharMsg(int charVal)
Builds "Illegal character" error message with given character value.
|
protected void |
setNoCloseBracketMsg()
Builds "Close bracket not found" error message.
|
protected void |
setNoOpenBracketMsg()
Builds "Open bracket not found" error message.
|
protected void |
setUnexpectedEOFMsg()
Builds "Unexpected end-of-file" error message.
|
protected static final char OPEN_BRACKET_CHAR
protected static final char CLOSE_BRACKET_CHAR
protected final boolean wordSlashFlag
protected final boolean commaSepFlag
protected CfgFileTokenizer inTokens
protected java.lang.String errorMessage
public CfgFileParser(java.io.Reader rdr, boolean wordSlashFlag, boolean commaSepFlag)
rdr
- readerwordSlashFlag
- true to allow the forward-slash character to be
parsed as part of a word token (this disables '//' comments); false
to make the forward-slash character be a token separator.commaSepFlag
- true for comma to be a token separator; false
for comma to be parsed as part of a word token.public CfgFileParser(java.io.Reader rdr, boolean wordSlashFlag)
rdr
- readerwordSlashFlag
- true to allow the forward-slash character to be
parsed as part of a word token (this disables '//' comments); false
to make the forward-slash character be a token separator.public CfgFileParser(java.io.Reader rdr)
rdr
- readerpublic void resetInput(java.io.Reader rdr)
rdr
- reader input stream object to use.protected java.lang.String parseEqualsString() throws java.io.IOException
java.io.IOException
protected java.lang.Number parseEqualsNumber() throws java.io.IOException
java.io.IOException
protected void setIllegalCharMsg(int charVal)
charVal
- character valueprotected void setUnexpectedEOFMsg()
protected void setNoOpenBracketMsg()
protected void setNoCloseBracketMsg()
protected void setDupFieldMsg(java.lang.String fieldName)
fieldName
- field namepublic java.lang.String getErrorMessage()