Package com.l2fprod.util
Class IniFile
- java.lang.Object
-
- 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
Constructors Constructor Description IniFile()Constructor for the IniFile objectIniFile(java.io.InputStream input)Constructor for the IniFile objectIniFile(java.lang.String filename)Constructor for the IniFile objectIniFile(java.net.URL url)Constructor for the IniFile object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddSection(java.lang.String section)Adds a feature to the Section attribute of the IniFile objectbooleangetKeyBooleanValue(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.intgetKeyIntValue(java.lang.String section, java.lang.String key)Gets the KeyIntValue attribute of the IniFile objectintgetKeyIntValue(java.lang.String section, java.lang.String key, int defaultValue)Gets the KeyIntValue attribute of the IniFile objectjava.lang.String[][]getKeysAndValues(java.lang.String aSection)Gets the KeysAndValues attribute of the IniFile objectjava.lang.StringgetKeyValue(java.lang.String section, java.lang.String key)Gets the KeyValue attribute of the IniFile objectjava.util.HashtablegetSection(java.lang.String section)Gets the Section attribute of the IniFile objectjava.util.HashtablegetSections()Gets the Sections attribute of the IniFile objectjava.lang.StringgetSectionWhere(java.lang.String[][] query)booleanisNullOrEmpty(java.lang.String section, java.lang.String key)Gets the NullOrEmpty attribute of the IniFile objectvoidload(java.io.InputStream in)Description of the Methodvoidload(java.lang.String filename)Description of the Methodstatic voidmain(java.lang.String[] args)Simple test functionvoidremoveSection(java.lang.String section)Description of the Methodvoidsave(java.io.OutputStream out)Description of the Methodvoidsave(java.lang.String filename)Description of the MethodvoidsetKeyValue(java.lang.String section, java.lang.String key, java.lang.String value)Sets the KeyValue attribute of the IniFile object
-
-
-
Constructor Detail
-
IniFile
public IniFile()
Constructor for the IniFile object
-
IniFile
public IniFile(java.lang.String filename) throws java.io.FileNotFoundExceptionConstructor 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.IOExceptionConstructor 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 valuekey- The new KeyValue valuevalue- 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 Parameterkey- 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 Parameterkey- 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 Parameterkey- 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 Parameterkey- Description of ParameterdefaultValue- 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.FileNotFoundExceptionDescription 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.IOExceptionDescription 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.ExceptionSimple test function- Parameters:
args- The command line arguments- Throws:
java.lang.Exception- Description of Exception
-
-