|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectdods.util.iniFile
public class iniFile
This class encapsulates the old .ini file functionality that we used to see (and still do) in the Microsoft Operating Systems. This is a handy way of delivering configuration information to software at runtime. The .ini file structure is as follows:
[SectionName]
PropertyName = Property
NextPropertyName = Property2
AnotherPropertyName = Property3
[AnotherSectionName]
PropertyName = Property
NextPropertyName = Property2
AnotherPropertyName = Property3
This class opens and parses the iniFile it's constructor. If the file isn't accesible or is unparsable then the class will not contain any usable configuration information.
Constructor Summary | |
---|---|
protected |
iniFile()
We don't want this to get used so we made it protected... |
|
iniFile(java.lang.String fname)
Create a iniFile object from the file named in the
parameter fname . |
|
iniFile(java.lang.String path,
java.lang.String fname)
Create a iniFile object from the file named in the
parameter fname , and found on the parameter path |
|
iniFile(java.lang.String path,
java.lang.String fname,
boolean dbg)
Create a iniFile object from the file named in the
parameter fname , and found on the parameter path |
Method Summary | |
---|---|
java.lang.String |
getFileName()
Get the name of the .ini file that was used to create this object. |
java.lang.String |
getProperty(java.lang.String propertyName)
Get the named property from the current section. |
java.util.Enumeration |
getPropList(java.lang.String sectionName)
Get the list of properties for the section sectionName . |
java.util.Enumeration |
getSectionList()
Get the list of Sections of this .ini File |
void |
printProps(java.io.PrintStream ps)
Prints the iniFile. |
boolean |
setSection(java.lang.String sectionName)
Set the section of the iniFile that you wish to work with. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected iniFile()
public iniFile(java.lang.String fname)
iniFile
object from the file named in the
parameter fname
. The object will get the append to the
file name to the path returned by the call
System.getProperty("user.home")
.
fname
- A String
containing the name of the .ini file.public iniFile(java.lang.String path, java.lang.String fname)
iniFile
object from the file named in the
parameter fname
, and found on the parameter path
path
- A String
containing the path to the .ini file.fname
- A String
containing the name of the .ini file.public iniFile(java.lang.String path, java.lang.String fname, boolean dbg)
iniFile
object from the file named in the
parameter fname
, and found on the parameter path
path
- A String
containing the path to the .ini file.fname
- A String
containing the name of the .ini file.dbg
- A boolean
that toggles debugging output.Method Detail |
---|
public java.lang.String getFileName()
String
containing the name of the .ini file
that was opened a parsed when this object was instantiated.
public java.util.Enumeration getPropList(java.lang.String sectionName)
sectionName
.
sectionName
- A String
containing the name of the
section whose property list is desired.public java.lang.String getProperty(java.lang.String propertyName)
propertyName
- The name of the desired property.public java.util.Enumeration getSectionList()
public void printProps(java.io.PrintStream ps)
ps
- The PrintStream
to which to print.public boolean setSection(java.lang.String sectionName)
sectionName
- A String
containing the name of the
section that is desired.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |