Package org.jboss.util.property
Class FilePropertyReader
- java.lang.Object
-
- org.jboss.util.property.FilePropertyReader
-
- All Implemented Interfaces:
PropertyReader
- Direct Known Subclasses:
DefaultPropertyReader
public class FilePropertyReader extends java.lang.Object implements PropertyReader
Reads properties from one or more files.- Version:
- $Revision$
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String[]
filenames
Array of filenames to load properties from
-
Constructor Summary
Constructors Constructor Description FilePropertyReader(java.lang.String filename)
Construct a FilePropertyReader with a single filename to read from.FilePropertyReader(java.lang.String[] filenames)
Construct a FilePropertyReader with an array of filenames to read from.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.io.InputStream
getInputStream(java.lang.String filename)
Get an input stream for the given filename.protected void
loadProperties(java.util.Properties props, java.lang.String filename)
Load properties from a file into a properties map.java.util.Map
readProperties()
Read properties from each specified filename
-
-
-
Constructor Detail
-
FilePropertyReader
public FilePropertyReader(java.lang.String[] filenames)
Construct a FilePropertyReader with an array of filenames to read from.- Parameters:
filenames
- Filenames to load properties from
-
FilePropertyReader
public FilePropertyReader(java.lang.String filename)
Construct a FilePropertyReader with a single filename to read from.- Parameters:
filename
- Filename to load properties from
-
-
Method Detail
-
getInputStream
protected java.io.InputStream getInputStream(java.lang.String filename) throws java.io.IOException
Get an input stream for the given filename.- Parameters:
filename
- File name to get input stream for.- Returns:
- Input stream for file.
- Throws:
java.io.IOException
- Failed to get input stream for file.
-
loadProperties
protected void loadProperties(java.util.Properties props, java.lang.String filename) throws java.io.IOException
Load properties from a file into a properties map.- Parameters:
props
- Properties map to load properties into.filename
- Filename to read properties from.- Throws:
java.io.IOException
- Failed to load properties from filename.java.lang.IllegalArgumentException
- Filename is invalid.
-
readProperties
public java.util.Map readProperties() throws PropertyException, java.io.IOException
Read properties from each specified filename- Specified by:
readProperties
in interfacePropertyReader
- Returns:
- Read properties
- Throws:
PropertyException
- Failed to read properties.java.io.IOException
- I/O error while reading properties.
-
-