read properties file into map (filename a, [encoding b], map c)


This function can read a properties file from local file system and insert the key-value pairs into a named map. The map is not cleared before. The name of the map is expected in the mandatory parameter c. There is no default name. If a named map with this name did not exist before it is created.

The mandatory parameter a gives the relative or absolute path for the properties file. If this file does not exist, the function will fail with an error.

By default, a properties file has the character encoding ISO-8859-1. However, the optional parameter b can specify another encoding.

The return value is the count of key-value pairs within the map after execution.

Description of Parameters

Parameter

Description

a

Filename.

b

(optional) Encoding. Default: 8859_1

c

Name of map.

Examples

Assume, that the Map ABC was empty or did not exist and the file ./conf/xyz.properties is a properties file with 8859_1 encoding containing three properties with unique keys.

Parameter a

Parameter b

Parameter c

Result

./conf/xyz.properties

ABC

3

The real result of the function is that now a named map object ABC exists, which contains three key-value pairs.