com.go.trove.util
Class PropertyParser

java.lang.Object
  |
  +--com.go.trove.util.PropertyParser

public class PropertyParser
extends java.lang.Object

Parses a properties file similar to how java.util.Properties does, except:

Just like Properties, comment lines start with optional whitespace followed by a '#' or '!'. Keys and values may have an optional '=' or ':' as a separator, unicode escapes are supported as well as other common escapes. A line may end in a backslash so that it continues to the next line. Escapes for brace characters '{' and '}' are also supported. Example:
 # Properties file

 foo = bar
 foo.sub = blink
 empty

 block {
     inner {
         foo = bar
         item
     }
     next.item = "true"
 }

 section = test {
     level = 4
     message = "Message: "
 }
 
is equivalent to
 # Properties file

 foo = bar
 foo.sub = blink
 empty

 block.inner.foo = bar
 block.inner.item
 block.next.item = true

 section = test
 section.level = 4
 section.message = Message: 
 

Version:
8 , 12/11/00
Author:
Brian S O'Neill

Inner Class Summary
static class PropertyParser.ErrorEvent
           
static interface PropertyParser.ErrorListener
           
 
Constructor Summary
PropertyParser(java.util.Map map)
           
 
Method Summary
 void addErrorListener(PropertyParser.ErrorListener listener)
           
 int getErrorCount()
          Total number of errors accumulated by this PropertyParser instance.
 void parse(java.io.Reader reader)
          Parses properties from the given reader and stores them in the Map.
 void removeErrorListener(PropertyParser.ErrorListener listener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PropertyParser

public PropertyParser(java.util.Map map)
Parameters:
map - Map to receive properties
Method Detail

addErrorListener

public void addErrorListener(PropertyParser.ErrorListener listener)

removeErrorListener

public void removeErrorListener(PropertyParser.ErrorListener listener)

parse

public void parse(java.io.Reader reader)
           throws java.io.IOException
Parses properties from the given reader and stores them in the Map. To capture any parsing errors, call addErrorListener prior to parsing.

getErrorCount

public int getErrorCount()
Total number of errors accumulated by this PropertyParser instance.