org.jagatoo.util.ini
Class AbstractIniParser

java.lang.Object
  extended by org.jagatoo.util.ini.AbstractIniParser

public abstract class AbstractIniParser
extends java.lang.Object

The AbstractIniParser parses ini files ;).


Constructor Summary
AbstractIniParser()
          Creates a new AbstractIniParser.
 
Method Summary
protected  boolean onCommentParsed(int lineNr, java.lang.String group, java.lang.String comment)
          This method is invoked, when a standalone comment line has been found.
protected  boolean onGroupParsed(int lineNr, java.lang.String group)
          This method is invoked, when a new group has been found.
protected  void onParsingFinished()
          This method is invoked when the parsing of the file as been finished.
protected abstract  boolean onSettingParsed(int lineNr, java.lang.String group, java.lang.String key, java.lang.String value, java.lang.String comment)
          This method is invoked, when a new setting has been found.
 void parse(java.io.File file)
          Parses the given file.
 void parse(java.io.InputStream in)
          Parses the given file.
 void parse(java.io.Reader reader)
          Parses the given file.
 void parse(java.lang.String filename)
          Parses the given file.
 void parse(java.net.URL url)
          Parses the given file.
protected  void parseImpl(java.io.BufferedReader reader)
          Parses the given file.
protected  boolean parseLine(int lineNr, java.lang.String currentGroup, java.lang.String line)
          Parses the given line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIniParser

public AbstractIniParser()
Creates a new AbstractIniParser.

Method Detail

onCommentParsed

protected boolean onCommentParsed(int lineNr,
                                  java.lang.String group,
                                  java.lang.String comment)
                           throws ParsingException
This method is invoked, when a standalone comment line has been found.

Parameters:
lineNr -
group -
comment -
Returns:
true, to indicate, that parsing should be proceeded, false to stop parsing.
Throws:
ParsingException

onGroupParsed

protected boolean onGroupParsed(int lineNr,
                                java.lang.String group)
                         throws ParsingException
This method is invoked, when a new group has been found.

Parameters:
lineNr -
group -
Returns:
true, to indicate, that parsing should be proceeded, false to stop parsing.
Throws:
ParsingException

onSettingParsed

protected abstract boolean onSettingParsed(int lineNr,
                                           java.lang.String group,
                                           java.lang.String key,
                                           java.lang.String value,
                                           java.lang.String comment)
                                    throws ParsingException
This method is invoked, when a new setting has been found.

Parameters:
lineNr -
group -
key -
value -
comment - the comment behind the value. (can be null)
Returns:
true, to indicate, that parsing should be proceeded, false to stop parsing.
Throws:
ParsingException

onParsingFinished

protected void onParsingFinished()
This method is invoked when the parsing of the file as been finished.


parseLine

protected boolean parseLine(int lineNr,
                            java.lang.String currentGroup,
                            java.lang.String line)
                     throws java.io.IOException,
                            ParsingException
Parses the given line.
This method implements the actual parsing code for a single line.

Parameters:
lineNr -
currentGroup -
line -
Throws:
java.io.IOException
ParsingException

parseImpl

protected void parseImpl(java.io.BufferedReader reader)
                  throws java.io.IOException,
                         ParsingException
Parses the given file.
This method implements the actual parsing code.

Parameters:
reader -
Throws:
java.io.IOException
ParsingException

parse

public final void parse(java.io.Reader reader)
                 throws java.io.IOException,
                        ParsingException
Parses the given file.

Parameters:
reader -
Throws:
java.io.IOException
ParsingException

parse

public final void parse(java.io.InputStream in)
                 throws java.io.IOException,
                        ParsingException
Parses the given file.

Parameters:
in -
Throws:
java.io.IOException
ParsingException

parse

public final void parse(java.net.URL url)
                 throws java.io.IOException,
                        ParsingException
Parses the given file.

Parameters:
url -
Throws:
java.io.IOException
ParsingException

parse

public final void parse(java.io.File file)
                 throws java.io.IOException,
                        ParsingException
Parses the given file.

Parameters:
file -
Throws:
java.io.IOException
ParsingException

parse

public final void parse(java.lang.String filename)
                 throws java.io.IOException,
                        ParsingException
Parses the given file.

Parameters:
filename -
Throws:
java.io.IOException
ParsingException