站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

FilePropertyReader (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util.property
Class FilePropertyReader

java.lang.Object
  extended byorg.jboss.util.property.FilePropertyReader
All Implemented Interfaces:
PropertyReader
Direct Known Subclasses:
DefaultPropertyReader

public class FilePropertyReader
extends Object
implements PropertyReader

Reads properties from one or more files.

Version:
$Revision: 1.4 $
Author:
Jason Dillon

Field Summary
protected  String[] filenames
          Array of filenames to load properties from
 
Constructor Summary
FilePropertyReader(String filename)
          Construct a FilePropertyReader with a single filename to read from.
FilePropertyReader(String[] filenames)
          Construct a FilePropertyReader with an array of filenames to read from.
 
Method Summary
protected  InputStream getInputStream(String filename)
          Get an input stream for the given filename.
protected  void loadProperties(Properties props, String filename)
          Load properties from a file into a properties map.
 Map readProperties()
          Read properties from each specified filename
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filenames

protected String[] filenames
Array of filenames to load properties from

Constructor Detail

FilePropertyReader

public FilePropertyReader(String[] filenames)
Construct a FilePropertyReader with an array of filenames to read from.

Parameters:
filenames - Filenames to load properties from

FilePropertyReader

public FilePropertyReader(String filename)
Construct a FilePropertyReader with a single filename to read from.

Parameters:
filename - Filename to load properties from
Method Detail

getInputStream

protected InputStream getInputStream(String filename)
                              throws IOException
Get an input stream for the given filename.

Parameters:
filename - File name to get input stream for.
Returns:
Input stream for file.
Throws:
IOException - Failed to get input stream for file.

loadProperties

protected void loadProperties(Properties props,
                              String filename)
                       throws 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:
IOException - Failed to load properties from filename.
IllegalArgumentException - Filename is invalid.

readProperties

public Map readProperties()
                   throws PropertyException,
                          IOException
Read properties from each specified filename

Specified by:
readProperties in interface PropertyReader
Returns:
Read properties
Throws:
PropertyException - Failed to read properties.
IOException - I/O error while reading properties.


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.