read properties file into map()
This function can read a properties file from local file system and insert the key-value pairs into a map c. The map is not cleared before. If the map did not exist before, it is created.
Parameter a specifies the relative or absolute path of the properties file. If this file does not exist, the function will terminate 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 number of key-value pairs inserted into the map.
Parameters
Parameter |
Description |
a |
File name. |
b |
(optional) Encoding. Default: 8859_1 |
c |
Name of the map. |
Examples
Assume, that the map myMap 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 |
|
myMap |
3 |
The real result of the function is that now a map myMap with three key-value pairs exists.