com.isti.util
Class SimplePropsParser

java.lang.Object
  extended by com.isti.util.SimplePropsParser

public class SimplePropsParser
extends java.lang.Object

Class SimplePropsParser is a simple parser for a string of name=value property items. Any of the items may be surrounded by quotes and whitespace is ignore. Using this class consumes less resources than converting the string to a 'Properties' or a 'CfgProperties' object.


Field Summary
protected  java.lang.String propertiesString
           
protected  int propsStrLen
           
protected  int propsStrPos
           
protected  char separatorChar
           
 
Constructor Summary
SimplePropsParser(java.lang.String propsStr)
          Creates a simple parser for a string of name=value property items.
SimplePropsParser(java.lang.String propsStr, char sepCh)
          Creates a simple parser for a string of name=value property items.
 
Method Summary
 java.lang.String getValue(java.lang.String nameStr)
          Returns the value associated with the given name string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

propertiesString

protected final java.lang.String propertiesString

separatorChar

protected final char separatorChar

propsStrLen

protected final int propsStrLen

propsStrPos

protected int propsStrPos
Constructor Detail

SimplePropsParser

public SimplePropsParser(java.lang.String propsStr,
                         char sepCh)
Creates a simple parser for a string of name=value property items.

Parameters:
propsStr - the string of property items to parse.
sepCh - the separator character for the property items.

SimplePropsParser

public SimplePropsParser(java.lang.String propsStr)
Creates a simple parser for a string of name=value property items. A comma is used as the separator character.

Parameters:
propsStr - the string of property items to parse.
Method Detail

getValue

public java.lang.String getValue(java.lang.String nameStr)
Returns the value associated with the given name string. Note that this method will be more efficient if property items are requested in same order as they appear in the property-items string.

Parameters:
nameStr - the name string to find.
Returns:
The associated value string, or null if none found.