Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.flexstor.common.util
Class PropertyReader  view PropertyReader download PropertyReader.java

java.lang.Object
  extended bycom.flexstor.common.util.PropertyReader

public class PropertyReader
extends java.lang.Object

PropertyReader provides functionality to read sections, properties and values from an input file. Data is accessed on demand with no caching.

Version:
3.0

Field Summary
private  java.net.URL fileURL
          Reference to URL object for input file.
private  com.flexstor.common.io.xfile.FlexXFile xInputFile
          Reference to XFile object for input file.
 
Constructor Summary
PropertyReader()
           
 
Method Summary
private  void closeInputFile(java.io.BufferedReader inputReader)
          Closes input file.
private  java.io.BufferedReader openInputFile()
          Opens input file.
 java.util.Hashtable readProperties()
          Retrieves all the properties in the file.
 java.lang.String[] readProperties(java.lang.String sSection)
          Retrieves the properties for a specific section.
 java.util.Hashtable readSection(java.lang.String sSection)
          Retrieves the property/value pairs for a specified section.
 java.lang.String[] readSections()
          Retrieves the sections defined in the input file.
 java.lang.String readValue(java.lang.String sProperty)
          Retrieves the value for a specific property.
 java.lang.String readValue(java.lang.String sSection, java.lang.String sProperty)
          Retrieves the value for a specific property within a section.
 void setInputFile(com.flexstor.common.io.xfile.FlexXFile xInputFile)
          Sets the input file to get data from.
 void setInputFile(java.lang.String sFileName)
          Sets the input file to get data from.
 void setInputFile(java.lang.String sFileName, boolean bUseXFile)
          Sets the input file to get data from.
 void setInputFile(java.net.URL fileURL)
          Sets the input file to get data from.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xInputFile

private com.flexstor.common.io.xfile.FlexXFile xInputFile
Reference to XFile object for input file.


fileURL

private java.net.URL fileURL
Reference to URL object for input file.

Constructor Detail

PropertyReader

public PropertyReader()
Method Detail

setInputFile

public void setInputFile(java.lang.String sFileName)
                  throws java.io.IOException
Sets the input file to get data from. Test file for reading. If sFileName start with "http://" or "file://" we read the data from an URL otherwise via FlexXFile. This condition may be removed once XFile supports URLs itself.


setInputFile

public void setInputFile(java.lang.String sFileName,
                         boolean bUseXFile)
                  throws java.io.IOException
Sets the input file to get data from. Test file for reading.


setInputFile

public void setInputFile(com.flexstor.common.io.xfile.FlexXFile xInputFile)
                  throws java.io.IOException
Sets the input file to get data from. Test file for reading.


setInputFile

public void setInputFile(java.net.URL fileURL)
                  throws java.io.IOException
Sets the input file to get data from. Test file for reading. This method uses the File class not the FlexXFile Class, due to problems with FlexXFile.


openInputFile

private java.io.BufferedReader openInputFile()
                                      throws java.io.IOException
Opens input file.


closeInputFile

private void closeInputFile(java.io.BufferedReader inputReader)
                     throws java.io.IOException
Closes input file.


readSections

public java.lang.String[] readSections()
Retrieves the sections defined in the input file.


readSection

public java.util.Hashtable readSection(java.lang.String sSection)
                                throws PropertyReaderException
Retrieves the property/value pairs for a specified section.


readProperties

public java.util.Hashtable readProperties()
Retrieves all the properties in the file.


readProperties

public java.lang.String[] readProperties(java.lang.String sSection)
                                  throws PropertyReaderException
Retrieves the properties for a specific section.


readValue

public java.lang.String readValue(java.lang.String sSection,
                                  java.lang.String sProperty)
                           throws PropertyReaderException
Retrieves the value for a specific property within a section.


readValue

public java.lang.String readValue(java.lang.String sProperty)
                           throws PropertyReaderException
Retrieves the value for a specific property.