com.l2fprod.util
Class IniFile

java.lang.Object
  extended by com.l2fprod.util.IniFile

public class IniFile
extends java.lang.Object

Version:
$Revision: 1.5 $, $Date: 2005/11/19 09:26:22 $
Author:
$Author: l2fprod $

Constructor Summary
IniFile()
          Constructor for the IniFile object
IniFile(java.io.InputStream input)
          Constructor for the IniFile object
IniFile(java.lang.String filename)
          Constructor for the IniFile object
IniFile(java.net.URL url)
          Constructor for the IniFile object
 
Method Summary
 void addSection(java.lang.String section)
          Adds a feature to the Section attribute of the IniFile object
 boolean getKeyBooleanValue(java.lang.String section, java.lang.String key, boolean defaultValue)
          return true if the value of the key is yes/true, false if no/false, defaultValue in all other cases.
 int getKeyIntValue(java.lang.String section, java.lang.String key)
          Gets the KeyIntValue attribute of the IniFile object
 int getKeyIntValue(java.lang.String section, java.lang.String key, int defaultValue)
          Gets the KeyIntValue attribute of the IniFile object
 java.lang.String[][] getKeysAndValues(java.lang.String aSection)
          Gets the KeysAndValues attribute of the IniFile object
 java.lang.String getKeyValue(java.lang.String section, java.lang.String key)
          Gets the KeyValue attribute of the IniFile object
 java.util.Hashtable getSection(java.lang.String section)
          Gets the Section attribute of the IniFile object
 java.util.Hashtable getSections()
          Gets the Sections attribute of the IniFile object
 java.lang.String getSectionWhere(java.lang.String[][] query)
           
 boolean isNullOrEmpty(java.lang.String section, java.lang.String key)
          Gets the NullOrEmpty attribute of the IniFile object
 void load(java.io.InputStream in)
          Description of the Method
 void load(java.lang.String filename)
          Description of the Method
static void main(java.lang.String[] args)
          Simple test function
 void removeSection(java.lang.String section)
          Description of the Method
 void save(java.io.OutputStream out)
          Description of the Method
 void save(java.lang.String filename)
          Description of the Method
 void setKeyValue(java.lang.String section, java.lang.String key, java.lang.String value)
          Sets the KeyValue attribute of the IniFile object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IniFile

public IniFile()
Constructor for the IniFile object


IniFile

public IniFile(java.lang.String filename)
        throws java.io.FileNotFoundException
Constructor for the IniFile object

Parameters:
filename - Description of Parameter
Throws:
java.io.FileNotFoundException - Description of Exception

IniFile

public IniFile(java.net.URL url)
        throws java.io.IOException
Constructor for the IniFile object

Parameters:
url - Description of Parameter
Throws:
java.io.IOException - Description of Exception

IniFile

public IniFile(java.io.InputStream input)
Constructor for the IniFile object

Parameters:
input - Description of Parameter
Method Detail

setKeyValue

public void setKeyValue(java.lang.String section,
                        java.lang.String key,
                        java.lang.String value)
Sets the KeyValue attribute of the IniFile object

Parameters:
section - The new KeyValue value
key - The new KeyValue value
value - The new KeyValue value

getSections

public java.util.Hashtable getSections()
Gets the Sections attribute of the IniFile object

Returns:
The Sections value

getSection

public java.util.Hashtable getSection(java.lang.String section)
Gets the Section attribute of the IniFile object

Parameters:
section - Description of Parameter
Returns:
The Section value

isNullOrEmpty

public boolean isNullOrEmpty(java.lang.String section,
                             java.lang.String key)
Gets the NullOrEmpty attribute of the IniFile object

Parameters:
section - Description of Parameter
key - Description of Parameter
Returns:
The NullOrEmpty value

getKeyValue

public java.lang.String getKeyValue(java.lang.String section,
                                    java.lang.String key)
Gets the KeyValue attribute of the IniFile object

Parameters:
section - Description of Parameter
key - Description of Parameter
Returns:
The KeyValue value

getKeyIntValue

public int getKeyIntValue(java.lang.String section,
                          java.lang.String key)
Gets the KeyIntValue attribute of the IniFile object

Parameters:
section - Description of Parameter
key - Description of Parameter
Returns:
The KeyIntValue value

getKeyIntValue

public int getKeyIntValue(java.lang.String section,
                          java.lang.String key,
                          int defaultValue)
Gets the KeyIntValue attribute of the IniFile object

Parameters:
section - Description of Parameter
key - Description of Parameter
defaultValue - Description of Parameter
Returns:
The KeyIntValue value

getKeyBooleanValue

public boolean getKeyBooleanValue(java.lang.String section,
                                  java.lang.String key,
                                  boolean defaultValue)
return true if the value of the key is yes/true, false if no/false, defaultValue in all other cases.

Parameters:
section -
key -
defaultValue -

getKeysAndValues

public java.lang.String[][] getKeysAndValues(java.lang.String aSection)
Gets the KeysAndValues attribute of the IniFile object

Parameters:
aSection - Description of Parameter
Returns:
The KeysAndValues value

getSectionWhere

public java.lang.String getSectionWhere(java.lang.String[][] query)

load

public void load(java.lang.String filename)
          throws java.io.FileNotFoundException
Description of the Method

Parameters:
filename - Description of Parameter
Throws:
java.io.FileNotFoundException - Description of Exception

save

public void save(java.lang.String filename)
          throws java.io.IOException
Description of the Method

Parameters:
filename - Description of Parameter
Throws:
java.io.IOException - Description of Exception

load

public void load(java.io.InputStream in)
Description of the Method

Parameters:
in - Description of Parameter

save

public void save(java.io.OutputStream out)
Description of the Method

Parameters:
out - Description of Parameter

addSection

public void addSection(java.lang.String section)
Adds a feature to the Section attribute of the IniFile object

Parameters:
section - The feature to be added to the Section attribute

removeSection

public void removeSection(java.lang.String section)
Description of the Method

Parameters:
section - Description of Parameter

main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Simple test function

Parameters:
args - The command line arguments
Throws:
java.lang.Exception - Description of Exception