easik.sketch.util.ini
Class IniFile

java.lang.Object
  extended by easik.sketch.util.ini.IniFile

public class IniFile
extends java.lang.Object

Class to read in and write out ini files

Since:
2006-07-11 Kevin Green
Version:
2006-08-04 Kevin Green
Author:
Ian Rutherford 2001, Kevin Green 2006

Field Summary
private  java.util.HashMap<java.lang.String,IniFileNode> _nodey
          Hash map of the IniFileNode, indexed by the name of the header
 
Constructor Summary
IniFile()
          Default constructor
 
Method Summary
 boolean addHeader(java.lang.String name)
          Adds a new IniFileNode for the new header
 void eraseAll()
          Removes all headers
 java.lang.String getData()
          Returns a string containing the formatted .ini file data
 IniFileNode getHeader(java.lang.String name)
          Return the IniFileNode for the given header
 boolean readIni(java.lang.String filename)
          Reads the ini from a file
 boolean removeHeader(java.lang.String name)
          Removes the given header
 boolean writeIni(java.lang.String filename)
          Writes the ini to a file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_nodey

private java.util.HashMap<java.lang.String,IniFileNode> _nodey
Hash map of the IniFileNode, indexed by the name of the header

Constructor Detail

IniFile

public IniFile()
Default constructor

Method Detail

addHeader

public boolean addHeader(java.lang.String name)
Adds a new IniFileNode for the new header

Parameters:
name - The title of the new header
Returns:
True if the addition worked, false otherwise

removeHeader

public boolean removeHeader(java.lang.String name)
Removes the given header

Parameters:
name - The name of the header to be removed
Returns:
True if it was removed properly, false otherwise

eraseAll

public void eraseAll()
Removes all headers


getHeader

public IniFileNode getHeader(java.lang.String name)
Return the IniFileNode for the given header

Parameters:
name - The name of the header
Returns:
The IniFileNode for the given header, or null if the header does not exist

writeIni

public boolean writeIni(java.lang.String filename)
Writes the ini to a file

Parameters:
filename - The name of the ini file
Returns:
True if written properly, false otherwise

readIni

public boolean readIni(java.lang.String filename)
Reads the ini from a file

Parameters:
filename - The name of the ini file
Returns:
True if read in properly, false otherwise

getData

public java.lang.String getData()
Returns a string containing the formatted .ini file data

Returns:
A string containing the formatted .ini file data