## dods.util
Class iniFile

    java.lang.Object
      dods.util.iniFile

Direct Known Subclasses:
  DODSiniFile

public class iniFile
extends Object

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(String fname)` Create a `iniFile` object from the file named in the parameter `fname`.
`` `iniFile(String path, String fname)` Create a `iniFile` object from the file named in the parameter `fname`, and found on the parameter`path`
`` `iniFile(String path, String fname, boolean dbg)` Create a `iniFile` object from the file named in the parameter `fname`, and found on the parameter`path`

Method Summary
`String` `getFileName()` Get the name of the .ini file that was used to create this object.
`String` `getProperty(String propertyName)` Get the named property from the current section.
`Enumeration` `getPropList(String sectionName)` Get the list of properties for the section `sectionName`.
`Enumeration` `getSectionList()` Get the list of Sections of this .ini File
`void` `printProps(PrintStream ps)` Prints the iniFile.
`boolean` `setSection(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

### iniFile

    protected iniFile()

  We don't want this to get used so we made it protected...

### iniFile

    public iniFile(String fname)

  Create a `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")`.

Parameters:
  `fname` - A `String` containing the name of the .ini file.

### iniFile

    public iniFile(String path,
                   String fname)

  Create a `iniFile` object from the file named in the parameter `fname`, and found on the parameter`path`

Parameters:
  `path` - A `String` containing the path to the .ini file.
  `fname` - A `String` containing the name of the .ini file.

### iniFile

    public iniFile(String path,
                   String fname,
                   boolean dbg)

  Create a `iniFile` object from the file named in the parameter `fname`, and found on the parameter`path`

Parameters:
  `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

### getFileName

    public String getFileName()

  Get the name of the .ini file that was used to create this object. returns A `String` containing the name of the .ini file that was opened a parsed when this object was instantiated.

### getPropList

    public Enumeration getPropList(String sectionName)

  Get the list of properties for the section `sectionName`.

  Parameters:
    `sectionName` - A `String` containing the name of the section whose property list is desired.

### getProperty

    public String getProperty(String propertyName)

  Get the named property from the current section.

  Parameters:
    `propertyName` - The name of the desired property.

### getSectionList

    public Enumeration getSectionList()

  Get the list of Sections of this .ini File

### printProps

    public void printProps(PrintStream ps)

  Prints the iniFile.

  Parameters:
    `ps` - The `PrintStream` to which to print.

### setSection

    public boolean setSection(String sectionName)

  Set the section of the iniFile that you wish to work with. This is persistent for the life of the object, or until it's set again.

  Parameters:
    `sectionName` - A `String` containing the name of the section that is desired.