# Class: com.pnfsoftware.jeb.util.base.IniFileEditor

A reader\-and\-writer for `ini` configuration files. 

 Example of a valid ini file: 

```

 [section1]

 foo

 bar

 [section2]
 x
 y
 [section3]
 [section4]
 z

 
```

## Constructor: IniFileEditor
- parameter: `file`, type: `java.io.File`
- parameter: `commentChar`, type: `java.lang.Character`

Description: Create an editor by reading an ini file.
parameter: file: ini file
parameter: commentChar: optional full\-line comment character
throws: if the file cannot be read

## Constructor: IniFileEditor
- parameter: `file`, type: `java.io.File`

Description: Create an editor by reading an ini file.
parameter: file: ini file
throws: if the file cannot be read

## Constructor: IniFileEditor
- parameter: `str`, type: `java.lang.String`
- parameter: `commentChar`, type: `java.lang.Character`

Description: Create an editor from ini text.
parameter: str: ini text
parameter: commentChar: optional full\-line comment character

## Constructor: IniFileEditor
- parameter: `str`, type: `java.lang.String`

Description: Create an editor from ini text.
parameter: str: ini text

## Method: getCommentChar
- return type: `java.lang.Character`

Description: Retrieve the optional comment character \(full\-line comments only\).
return: comment character, or null if none is set

## Method: getSectionContents
- parameter: `sectionName`, type: `java.lang.String`
- return type: `java.util.List<java.lang.String>`

Description: Retrieve the contents of a section.
parameter: sectionName: section name, or null for the pre\-section header
return: the section contents, never null; blank entries are not present

## Method: getSectionKeyValues
- parameter: `sectionName`, type: `java.lang.String`
- return type: `java.util.Map<java.lang.String,java.lang.String>`

Description: Retrieve the key\-value entries for the provided section.
parameter: sectionName: case\-sensitive section name
return: a collection, possibly empty

## Method: getSectionNames
- return type: `java.util.List<java.lang.String>`

Description: Retrieve the list of sections in the ini file.
return: section names in file order

## Method: getValue
- parameter: `keyName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve a value.
parameter: keyName: key name
return: the value, null if not found

## Method: getValue
- parameter: `sectionName`, type: `java.lang.String`
- parameter: `keyName`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve a value.
parameter: sectionName: section name
parameter: keyName: key name
return: the value, null if not found

## Method: getValue
- parameter: `sectionName`, type: `java.lang.String`
- parameter: `keyName`, type: `java.lang.String`
- parameter: `delimiter`, type: `java.lang.String`
- return type: `java.lang.String`

Description: Retrieve a value.
parameter: sectionName: section name, or null for the pre\-section header
parameter: keyName: key name
parameter: delimiter: key\-value delimiter
return: the value, null if not found

## Method: setCommentChar
- parameter: `cc`, type: `java.lang.Character`

Description: Set a comment character for full\-line comments.
parameter: cc: optional full\-line comment character

## Method: setSectionContents
- parameter: `sectionName`, type: `java.lang.String`
- parameter: `contents`, type: `java.util.List<java.lang.String>`

Description: Set the contents of a new section. The section is created if it does not exist.
parameter: sectionName: section name \(without bracket\)
parameter: contents: blank lines are not added

## Method: setValue
- parameter: `sectionName`, type: `java.lang.String`
- parameter: `keyName`, type: `java.lang.String`
- parameter: `value`, type: `java.lang.String`
- return type: `boolean`

Description: Set a value.
parameter: sectionName: section name, or null for the pre\-section header
parameter: keyName: key name
parameter: value: value to set
return: true if the value was new or a true update; false if the key\-value pair already         exists

## Method: setValue
- parameter: `sectionName`, type: `java.lang.String`
- parameter: `keyName`, type: `java.lang.String`
- parameter: `value`, type: `java.lang.String`
- parameter: `delimiter`, type: `java.lang.String`
- return type: `boolean`

Description: Set a value.
parameter: sectionName: section name, or null for the pre\-section header
parameter: keyName: key name
parameter: value: value to set
parameter: delimiter: key\-value delimiter
return: true if the value was new or a true update; false if the key\-value pair already         exists

## Method: update

Description: Update the original ini file.
throws: if the file cannot be written

## Method: write
- parameter: `newFile`, type: `java.io.File`

Description: Write the updated contents to a new ini file.
parameter: newFile: destination file
throws: if the file cannot be written

