public class CfgFileTokenizer
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
TT_EOF
A constant indicating that the end of the stream has been read.
|
static int |
TT_EOL
A constant indicating that the end of the line has been read.
|
static int |
TT_NUMBER
A constant indicating that a number token has been read.
|
static int |
TT_WORD
A constant indicating that a word token has been read.
|
Constructor and Description |
---|
CfgFileTokenizer(java.io.Reader rdr)
Creates an object which reads from the given input stream.
|
CfgFileTokenizer(java.io.Reader rdr,
boolean wordSlashFlag)
Creates an object which reads from the given input stream.
|
CfgFileTokenizer(java.io.Reader rdr,
boolean wordSlashFlag,
boolean commaSepFlag)
Creates an object which reads from the given input stream.
|
Modifier and Type | Method and Description |
---|---|
void |
dumpTokens(java.io.PrintStream out)
Sends display of tokens to the given print stream.
|
java.lang.String |
getNonNullTokenString()
Returns the token string fetched by 'nextToken()'.
|
java.lang.Number |
getNumberToken()
Returns the token fetched by 'nextToken()' as a numeric object.
|
java.lang.String |
getTokenString()
Returns the token string fetched by 'nextToken()'.
|
int |
lineno()
Returns the current line number.
|
int |
nextToken()
Parses the next token from the input stream.
|
int |
nextToken(boolean eolFlag)
Parses the next token from the input stream.
|
public static final int TT_EOF
public static final int TT_EOL
public static final int TT_NUMBER
public static final int TT_WORD
public CfgFileTokenizer(java.io.Reader rdr, boolean wordSlashFlag, boolean commaSepFlag)
rdr
- the input stream to read from.wordSlashFlag
- 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 CfgFileTokenizer(java.io.Reader rdr, boolean wordSlashFlag)
rdr
- the input stream to read from.wordSlashFlag
- 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 CfgFileTokenizer(java.io.Reader rdr)
rdr
- the input stream to read from.public int nextToken(boolean eolFlag) throws java.io.IOException
eolFlag
- if true then all tokens and words until the next
end-of-line are read in and returned as a single token string.java.io.IOException
- if an I/O error occurs.public int nextToken() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.public java.lang.String getTokenString()
public java.lang.String getNonNullTokenString()
public java.lang.Number getNumberToken()
public int lineno()
public void dumpTokens(java.io.PrintStream out) throws java.io.IOException
out
- output streamjava.io.IOException
- if an I/O error occurs.