|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.metastatic.rsync.Parameters
Simple parser for Samba-style config files. The parameters are
passed back to the caller via a simple event listener callback
interface, ParameterListener
.
A sample file looks like:
[section one] parameter one = value string parameter two = another value [section two] new parameter = some value or t'other
The syntax is roughly:
file ::= parameter* section* EOF section ::= header parameter* header ::= '[' NAME ']' parameter ::= NAME '=' VALUE EOL
Blank lines, and lines that begin with either '#' or ';' are ignored. long lines may be continued by preceding the end-of-line character(s) with a backslash ('\').
Constructor Summary | |
---|---|
Parameters(ParameterListener listener)
Create a new parameter file parser. |
Method Summary | |
---|---|
void |
begin(String filename)
Begin parsing file filename. |
void |
parse()
Parse, or continue parsing the file if a parsing error occured in a previous call to this method. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Parameters(ParameterListener listener)
ParameterListener
which will take the
parsed arguments.
listener
- The parameter listener.Method Detail |
public void begin(String filename) throws IOException
filename
- The name of the file to parse.
IOException
- If an I/O error occurs.public void parse() throws IOException
begin(java.lang.String)
must have succeeded before this method
is called.
ParameterException
- If a parsing error occurs. Parsing can
continue if this exception is thrown by calling this
method again.
IOException
- If an I/O error occurs.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |