ccl.util
Class IniFile
java.lang.Object
|
+--ccl.util.IniFile
- public class IniFile
- extends java.lang.Object
This class is copyrighted by 1996 Besiex Software (Benjarmin Cabell)
and distributed under the terms of the Gnu Library General Public License.
This class reads Windows like .ini files and can set values
as well. The standard Java way is to use property files
instead, but if you have legacy code which uses ini files or
if you want to access for example a kde .kderc configuration
file, then this class is for you.
Field Summary |
static int |
FILE_ERROR
Reading the ini file resulted in an error. |
static int |
KEY_ERROR
Reading the ini file resulted in an error when parsing for a key. |
static int |
OK
Indicates that reading the ini file worked fine. |
static int |
SECTION_ERROR
Reading the ini file resulted in an error when parsing a section. |
Method Summary |
static java.lang.String |
getKeyValue(java.lang.String sIniFullFileName_,
java.lang.String sSectionName_,
java.lang.String sKey_)
|
static java.lang.String |
getKeyValue(java.lang.String sIniFullFileName_,
java.lang.String sSectionName_,
java.lang.String sKey_,
java.lang.String sIniFileContent_)
Returns the value for the given key in the given
section. |
static java.lang.String |
getKeyValueFromString(java.lang.String sSectionName_,
java.lang.String sKey_,
java.lang.String sIniFileContent_)
Returns the value for the given key in the given
String. |
static int |
getStatus()
Ini file status indicates any problems. |
static void |
setKeyValue(java.lang.String sIniFileName_,
java.lang.String sSection_,
java.lang.String sKey_,
java.lang.String sValue_)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
OK
public static final int OK
- Indicates that reading the ini file worked fine.
FILE_ERROR
public static final int FILE_ERROR
- Reading the ini file resulted in an error.
SECTION_ERROR
public static final int SECTION_ERROR
- Reading the ini file resulted in an error when parsing a section.
KEY_ERROR
public static final int KEY_ERROR
- Reading the ini file resulted in an error when parsing for a key.
IniFile
public IniFile()
getKeyValue
public static java.lang.String getKeyValue(java.lang.String sIniFullFileName_,
java.lang.String sSectionName_,
java.lang.String sKey_)
getKeyValue
public static java.lang.String getKeyValue(java.lang.String sIniFullFileName_,
java.lang.String sSectionName_,
java.lang.String sKey_,
java.lang.String sIniFileContent_)
- Returns the value for the given key in the given
section. First the lookup takes place in the normal
ini file, if there is no value found, a second
lookup in the default ini content takes place.
- Parameters:
sIniFullFileName_
- (The foolowing comment is outdated: is not used if sIniFullFileName_ is not
equal null. Besides of that it's only
there to separate the method signature from
getKeyValue(String,String,String)
- what a hack.)sIniFileContent_
- (The foolowing comment is outdated:
if null it's the same as getKeyValue(String,
String,String). Otherwise it workes straight
on this String.)
getKeyValueFromString
public static java.lang.String getKeyValueFromString(java.lang.String sSectionName_,
java.lang.String sKey_,
java.lang.String sIniFileContent_)
- Returns the value for the given key in the given
String.
getStatus
public static int getStatus()
- Ini file status indicates any problems.
setKeyValue
public static void setKeyValue(java.lang.String sIniFileName_,
java.lang.String sSection_,
java.lang.String sKey_,
java.lang.String sValue_)