public void load(Reader reader) throws ConfigurationException
{
try
{
BufferedReader bufferedReader = new BufferedReader(reader);
ConfigurationNode sectionNode = getRootNode();
String line = bufferedReader.readLine();
while (line != null)
{
line = line.trim();
if (!isCommentLine(line))
{
if (isSectionLine(line))
{
String section = line.substring(1, line.length() - 1);
sectionNode = getSectionNode(section);
}
else
{
String key = "";
String value = "";
int index = findSeparator(line);
if (index >= 0)
{
key = line.substring(0, index);
value = parseValue(line.substring(index + 1), bufferedReader);
}
else
{
key = line;
}
key = key.trim();
if (key.length() < 1)
{
// use space for properties with no key
key = " ";
}
ConfigurationNode node = createNode(key);
node.setValue(value);
sectionNode.addChild(node);
}
}
line = bufferedReader.readLine();