Class IniFile

java.lang.Object
   |
   +----IniFile

public class IniFile
extends Object
Class that manages the inifile of JaWavedit. All configuration parameters are stored in the file ".JaWavedit.conf".
A module can take advantage of this class by storing its own configuration parameters in it.
Each entry in the inifile consists of a section, a key and the value. The usage is much like the win3.11 ini-files.
The section should be a unique identifier for the module. It should be avoided that there is the possibility of other modules using by chance the same section.
The key defines the name of the value you want to store in the inifile.
Finally, the value is the value you want to store in the inifile. Currently, three types are supported: String, integer and boolean values.
All functions in this class are static, so you use IniFile by directly calling the function. For example, if the module "ShiftFrequency" wants to store the last set frequency in the inifile, it might use a call like this (after a call to apply):
IniFile.writeInteger("ShiftFrequencyModule", "LastFrequency", lastFreq);
lastFreq is the variable that will be stored in the module.
At startup of the module, the module wants to retrieve the last value. So this line would be added in the constructor of the module:
lastFreq=IniFile.readInteger("ShiftFrequencyModule", "LastFrequency", 200);
Like this, lastFreq is set to the last value it had. The "200" is the default value, when the entry does not exist in the ini file, typically when the module is called for the first time at all.

Note, that in an applet, a real inifile is not supported, as applets do not allow to read or write from/to local files. So in an applet, one of the read functions always returns the default value and the write functions are ignored.

One other function is of interest: "getProperty". This function is a wrapper for the "System.getProperty" function. It should be used in order to avoid exceptions when executed in an applet.


Constructor Index

 o IniFile()

Method Index

 o addIniListener(IniListener)
Adds an IniListener.
 o getProperty(String, String)
an "applet-save" wrapper of "System.getProperty"
 o readBool(String, String, boolean)
Use this function to read a boolean value.
 o readInteger(String, String, int)
Use this function to read an integer value.
 o readString(String, String, String)
Use this function to read a String value.
 o removeIniListener(IniListener)
removes the given IniListener.
 o writeBool(String, String, boolean)
Use this function to write a boolean value.
 o writeInteger(String, String, int)
Use this function to write an integer value.
 o writeString(String, String, String)
Use this function to write a String value.

Constructors

 o IniFile
 public IniFile()

Methods

 o getProperty
 public static String getProperty(String key,
                                  String defaultValue)
an "applet-save" wrapper of "System.getProperty"

 o readString
 public static String readString(String section,
                                 String key,
                                 String defaultValue)
Use this function to read a String value.

 o writeString
 public static void writeString(String section,
                                String key,
                                String value)
Use this function to write a String value.

 o readInteger
 public static int readInteger(String section,
                               String key,
                               int defaultValue)
Use this function to read an integer value.

 o writeInteger
 public static void writeInteger(String section,
                                 String key,
                                 int value)
Use this function to write an integer value.

 o readBool
 public static boolean readBool(String section,
                                String key,
                                boolean defaultValue)
Use this function to read a boolean value.

 o writeBool
 public static void writeBool(String section,
                              String key,
                              boolean value)
Use this function to write a boolean value.

 o addIniListener
 public static void addIniListener(IniListener il)
Adds an IniListener. The IniListener receives events when an entry in the IniFile has changed.

 o removeIniListener
 public static void removeIniListener(IniListener il)
removes the given IniListener.