net.sf.antcontrib.inifile
Class IniFile
java.lang.Object
net.sf.antcontrib.inifile.IniFile
public class IniFile
extends java.lang.Object
Class representing a windows style .ini file.
IniFile() -
Create a new IniFile object
|
String | getProperty(String section, String property) -
Gets a named property from a specific section
|
IniSection | getSection(String name) -
Gets the IniSection with the given name
|
List | getSections() -
Gets the List of IniSection objects contained in this IniFile
|
void | read(Reader reader) -
Reads from a Reader into the current IniFile instance.
|
void | removeProperty(String section, String property) -
Removes a property from a section.
|
void | removeSection(String name) -
Removes an entire section from the IniFile
|
void | setProperty(String section, String property, String value) -
Sets the value of a property in a given section.
|
void | setSection(IniSection section) -
Sets an IniSection object.
|
void | write(Writer writer) -
Writes the current iniFile instance to a Writer object for
serialization.
|
IniFile
public IniFile()
Create a new IniFile object
getProperty
public String getProperty(String section,
String property)
Gets a named property from a specific section
section
- The name of the sectionproperty
- The name of the property
- The property value, or null, if either the section or property
does not exist.
getSection
public IniSection getSection(String name)
Gets the IniSection with the given name
name
- the name of the section
getSections
public List getSections()
Gets the List of IniSection objects contained in this IniFile
- a List of IniSection objects
read
public void read(Reader reader)
throws IOException
Reads from a Reader into the current IniFile instance. Reading
appends to the current instance, so if the current instance has
properties, those properties will still exist.
reader
- The reader to read from.
removeProperty
public void removeProperty(String section,
String property)
Removes a property from a section.
section
- The name of the sectionproperty
- The name of the property
removeSection
public void removeSection(String name)
Removes an entire section from the IniFile
name
- The name of the section to remove
setProperty
public void setProperty(String section,
String property,
String value)
Sets the value of a property in a given section. If the section does
not exist, it is automatically created.
section
- The name of the sectionproperty
- The name of the propertyvalue
- The value of the property
setSection
public void setSection(IniSection section)
Sets an IniSection object. If a section with the given
name already exists, it is replaced with the passed in section.
section
- The section to set.
write
public void write(Writer writer)
throws IOException
Writes the current iniFile instance to a Writer object for
serialization.
writer
- The writer to write to