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[]filenamesArray 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.InputStreamgetInputStream(java.lang.String filename)Get an input stream for the given filename.protected voidloadProperties(java.util.Properties props, java.lang.String filename)Load properties from a file into a properties map.java.util.MapreadProperties()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.IOExceptionGet 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.IOExceptionLoad 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.IOExceptionRead properties from each specified filename- Specified by:
readPropertiesin interfacePropertyReader- Returns:
- Read properties
- Throws:
PropertyException- Failed to read properties.java.io.IOException- I/O error while reading properties.
-
-