com.tomgibara.pronto.config.source
Class DefaultPropertiesReader

java.lang.Object
  extended by com.tomgibara.pronto.config.source.DefaultPropertiesReader
All Implemented Interfaces:
PropertiesReader

public class DefaultPropertiesReader
extends java.lang.Object
implements PropertiesReader

Reads properties from an input stream using the java.util.Properties class.

Author:
Tom Gibara

Constructor Summary
DefaultPropertiesReader()
          Constructs a PropertiesReader which reads properties in the standard Java properties file format of dot separated, newline delimited key-value pairs.
DefaultPropertiesReader(boolean isXML)
          Constructs a PropertiesReader which reads properties in the standard Java properties file format.
 
Method Summary
 boolean isXML()
          Whether the properties are read as XML.
 java.util.Map<java.lang.String,java.lang.String> read(java.io.InputStream in)
          Reads the bytes from an input stream and returns a set of properties which have been extracted from it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPropertiesReader

public DefaultPropertiesReader()
Constructs a PropertiesReader which reads properties in the standard Java properties file format of dot separated, newline delimited key-value pairs.


DefaultPropertiesReader

public DefaultPropertiesReader(boolean isXML)
Constructs a PropertiesReader which reads properties in the standard Java properties file format.

Parameters:
isXML - whether the XML properties format should be used
Method Detail

isXML

public boolean isXML()
Whether the properties are read as XML.

Returns:
true if the properties are read as XML

read

public java.util.Map<java.lang.String,java.lang.String> read(java.io.InputStream in)
                                                      throws java.io.IOException
Description copied from interface: PropertiesReader
Reads the bytes from an input stream and returns a set of properties which have been extracted from it. This method exhausts the input stream but does not close it.

Specified by:
read in interface PropertiesReader
Parameters:
in - an input stream containing java formatted properties
Returns:
java formatted properties in a map
Throws:
java.io.IOException - if an exception occurs reading the stream


Copyright © 2006-2007 Tom Gibara. All Rights Reserved.