|
DbtuTools project Java Library |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.edelbyte.util.UnixCfgParser
A basic Unix configuration file parser. The parser reads from
a java.io.BufferedReader
(or one of its subclasses)
and returns a java.util.Properties
object with
the found key and value pairs. It is an alternative to the
java.lang.Properties.load()
method (which
has some strange behavior).
More information can be found in the detailed description
of the parse(java.io.BufferedReader)
method.
Field Summary | |
protected boolean |
bBetweenCheckEnabled
Field holding the activation status of the Between Check mechanism (default is false ). |
protected static java.lang.String |
COMMENT_TOKEN
Constant holding the token used for the comment detection within the stream. |
protected static java.lang.String |
CONTINUATION_TOKEN
Constant holding the token used for the line continuation detection within the stream. |
protected static java.lang.String |
EQUALS_TOKEN
Constant holding the token used for the key and value pair separation within the stream. |
protected java.lang.String |
oBetweenBeginToken
Field holding the token, which indicates the beginning of the key and value pairs part of the stream. |
protected java.lang.String |
oBetweenEndToken
Field holding the token, which indicates the end of the key and value pairs part of the stream. |
Constructor Summary | |
UnixCfgParser()
Creates a new instance of this class. |
Method Summary | |
java.lang.String |
getBetweenBeginToken()
Returns the token, which indicates the beginning of the key and value pairs part (from the oBetweenBeginToken field). |
java.lang.String |
getBetweenEndToken()
Returns the token, which indicates the end of the key and value pairs part (from the oBetweenEndToken field). |
boolean |
isBetweenCheckEnabled()
Returns true for the case, that the Between Check
mechanism is active.The Between Check mechanism ensures, that there are key and value pairs between the so called BetweenBegin and BetweenEnd tokens (see getBetweenBeginToken() and getBetweenEndToken() )
only. |
java.util.Properties |
parse(java.io.BufferedReader oReader)
Reads key and value pairs from a java.io.BufferedReader
(or one of its subclasses).The parser reads the stream line wise using the readLine()
method of the object given by the oReader parameter. |
void |
setBetweenBeginToken(java.lang.String oBetweenBeginToken)
Set a alternative value for the BetweenBegin token, which is used by the Between Check mechanism. |
void |
setBetweenCheckEnabled(boolean bStatus)
Enables or disables the Between Check mechanism while parsing the stream. The Between Check mechanism ensures, that there are key and value pairs between the so called BetweenBegin and BetweenEnd tokens (see getBetweenBeginToken() and getBetweenEndToken() )
only. |
void |
setBetweenEndToken(java.lang.String oBetweenEndToken)
Set a alternative value for the BetweenEnd token, which is used by the Between Check mechanism. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.lang.String COMMENT_TOKEN
protected static final java.lang.String EQUALS_TOKEN
protected static final java.lang.String CONTINUATION_TOKEN
protected java.lang.String oBetweenBeginToken
protected java.lang.String oBetweenEndToken
protected boolean bBetweenCheckEnabled
false
).Constructor Detail |
public UnixCfgParser()
Method Detail |
public java.lang.String getBetweenBeginToken()
oBetweenBeginToken
field).public java.lang.String getBetweenEndToken()
oBetweenEndToken
field).public boolean isBetweenCheckEnabled()
true
for the case, that the Between Check
mechanism is active.getBetweenBeginToken()
and getBetweenEndToken()
)
only.true
if the Between Check mechanism
is active.public java.util.Properties parse(java.io.BufferedReader oReader) throws java.io.IOException, java.text.ParseException
java.io.BufferedReader
(or one of its subclasses).readLine()
method of the object given by the oReader
parameter.
A line can hold up to one key and value pair. Everything after the
first occurrence of "#
" is interpreted as
comment and therefore skipped. Lines containing tabs and blanks only
are skipped as well. The first occurrence of "=
"
is interpreted as a delimiter separating key and value. After the
separation of key and value, the key is converted to upper case.
Lines ending with " \
" (please notice the
blank leading the backslash!) indicates a line continuation.java.util.Properties
object contains the following key and value pairs:BACKUP.ENABLED
" and the associated
value is "YES
".BACKUP.RULE.1
" and the associated
value is "(A > B) && (C != D)
".oReader
- The name of the DB2 Instance to be addressed.java.util.Properties
object containing
the key and value pairs found while parsing.java.io.IOException
- For the case, that there was an error while reading
the stream.java.text.ParseException
- For the case, that there was an error while parsing
the stream.public void setBetweenBeginToken(java.lang.String oBetweenBeginToken)
oBetweeenBeginToken
- The String containing the new value
(for the oBetweenBeginToken
field).public void setBetweenCheckEnabled(boolean bStatus)
getBetweenBeginToken()
and getBetweenEndToken()
)
only.bStatus
- The status for the Between Check mechanism to be set.public void setBetweenEndToken(java.lang.String oBetweenEndToken)
oBetweeenEndToken
- The String containing the new value
(for the oBetweenEndToken
field).
|
DbtuTools project Java Library |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |