Managing configuration files with the IniFile class

The toolkit provides the following class to manipulate the entries in configuration files.

com.entrust.toolkit.utility.IniFile;

See below for how to use this class.

Importing the IniFile class

Import the IniFile class into your source code.

import com.entrust.toolkit.utility.IniFile;

Loading a configuration file

Create a reference to the configuration file.

IniFile properties = new IniFile(<config_file>);

Specifically, the IniFile class has 3 constructors.

Constructor

Description

​public IniFile()

Initializes a configuration file.

public IniFile(java.lang.String filename)

Initializes a named configuration file.

public IniFile(java.io.InputStream is)

Initializes the configuration file pointed to by the input stream.

Reading a configuration file

Read data from the configuration file.

String to = null;
String from = null;
to = properties.getString("SMimeSend", "to");
from = properties.getString("SMimeSend", "from");

Updating a configuration file

Update the configuration file contents with methods described in the IniFile Javadoc reference.