public interface Config
Config
object is used to manipulate a configuration file.
The format of the configuration file is a .ini like format:
Example:Modifier and Type | Method and Description |
---|---|
void |
cleanEntry(java.lang.String section,
java.lang.String key)
Removes entries for key,value in a section.
|
void |
cleanSection(java.lang.String section)
Removes every pair of key,value in a section and remove the section.
|
java.lang.String |
dump()
Dumps the
Config as INI into a buffer. |
java.lang.String |
dumpAsXml()
Dumps the
Config as XML into a buffer. |
boolean |
getBool(java.lang.String section,
java.lang.String key,
boolean defaultValue)
Retrieves a configuration item as a boolean, given its section, key, and
default value.
|
float |
getDefaultFloat(java.lang.String section,
java.lang.String key,
float defaultValue)
Retrieves a default configuration item as a float, given its section, key, and
default value.
|
int |
getDefaultInt(java.lang.String section,
java.lang.String key,
int defaultValue)
Retrieves a default configuration item as an integer, given its section, key,
and default value.
|
int |
getDefaultInt64(java.lang.String section,
java.lang.String key,
int defaultValue)
Retrieves a default configuration item as a 64 bit integer, given its section,
key, and default value.
|
java.lang.String |
getDefaultString(java.lang.String section,
java.lang.String key,
java.lang.String defaultValue)
Retrieves a default configuration item as a string, given its section, key, and
default value.
|
float |
getFloat(java.lang.String section,
java.lang.String key,
float defaultValue)
Retrieves a configuration item as a float, given its section, key, and default
value.
|
int |
getInt(java.lang.String section,
java.lang.String key,
int defaultValue)
Retrieves a configuration item as an integer, given its section, key, and
default value.
|
int |
getInt64(java.lang.String section,
java.lang.String key,
int defaultValue)
Retrieves a configuration item as a 64 bit integer, given its section, key, and
default value.
|
boolean |
getOverwriteFlagForEntry(java.lang.String section,
java.lang.String key)
Retrieves the overwrite flag for a config item.
|
boolean |
getOverwriteFlagForSection(java.lang.String section)
Retrieves the overwrite flag for a config section.
|
java.lang.String |
getSectionParamString(java.lang.String section,
java.lang.String key,
java.lang.String defaultValue)
Retrieves a section parameter item as a string, given its section and key.
|
java.lang.String[] |
getSectionsNamesList()
Returns the list of sections' names in the LinphoneConfig.
|
boolean |
getSkipFlagForEntry(java.lang.String section,
java.lang.String key)
Retrieves the skip flag for a config item.
|
boolean |
getSkipFlagForSection(java.lang.String section)
Retrieves the skip flag for a config section.
|
java.lang.String |
getString(java.lang.String section,
java.lang.String key,
java.lang.String defaultString)
Retrieves a configuration item as a string, given its section, key, and default
value.
|
java.lang.String[] |
getStringList(java.lang.String section,
java.lang.String key,
java.lang.String[] defaultList)
Retrieves a configuration item as a list of strings, given its section, key,
and default value.
|
java.lang.Object |
getUserData()
Gets the object stored in this object user's data
|
int |
hasEntry(java.lang.String section,
java.lang.String key)
Returns 1 if a given section with a given key is present in the configuration.
|
int |
hasSection(java.lang.String section)
Returns 1 if a given section is present in the configuration.
|
java.lang.String |
loadFromXmlFile(java.lang.String filename)
Reads a xml config file and fill the
Config with the read config
dynamic values. |
int |
loadFromXmlString(java.lang.String buffer)
Reads a xml config string and fill the
Config with the read config
dynamic values. |
Config |
newFromBuffer(java.lang.String buffer)
Instantiates a
Config object from a user provided buffer. |
Config |
newWithFactory(java.lang.String configFilename,
java.lang.String factoryConfigFilename)
Instantiates a
Config object from a user config file and a factory
config file. |
int |
readFile(java.lang.String filename)
Reads a user config file and fill the
Config with the read config
values. |
boolean |
relativeFileExists(java.lang.String filename) |
void |
reload()
Reload the config from the file.
|
void |
setBool(java.lang.String section,
java.lang.String key,
boolean value)
Sets a boolean config item.
|
void |
setFloat(java.lang.String section,
java.lang.String key,
float value)
Sets a float config item.
|
void |
setInt(java.lang.String section,
java.lang.String key,
int value)
Sets an integer config item.
|
void |
setInt64(java.lang.String section,
java.lang.String key,
int value)
Sets a 64 bits integer config item.
|
void |
setIntHex(java.lang.String section,
java.lang.String key,
int value)
Sets an integer config item, but store it as hexadecimal.
|
void |
setOverwriteFlagForEntry(java.lang.String section,
java.lang.String key,
boolean value)
Sets the overwrite flag for a config item (used when dumping config as xml)
|
void |
setOverwriteFlagForSection(java.lang.String section,
boolean value)
Sets the overwrite flag for a config section (used when dumping config as xml)
|
void |
setRange(java.lang.String section,
java.lang.String key,
int minValue,
int maxValue)
Sets a range config item.
|
void |
setSkipFlagForEntry(java.lang.String section,
java.lang.String key,
boolean value)
Sets the skip flag for a config item (used when dumping config as xml)
|
void |
setSkipFlagForSection(java.lang.String section,
boolean value)
Sets the skip flag for a config section (used when dumping config as xml)
|
void |
setString(java.lang.String section,
java.lang.String key,
java.lang.String value)
Sets a string config item.
|
void |
setStringList(java.lang.String section,
java.lang.String key,
java.lang.String[] value)
Sets a string list config item.
|
void |
setUserData(java.lang.Object data)
Sets the object to store in this object user's data
|
int |
sync()
Writes the config file to disk.
|
void |
writeRelativeFile(java.lang.String filename,
java.lang.String data)
Write a string in a file placed relatively with the Linphone configuration
file.
|
java.lang.String[] getSectionsNamesList()
void cleanEntry(java.lang.String section, java.lang.String key)
key
- void cleanSection(java.lang.String section)
java.lang.String dump()
Config
as INI into a buffer.java.lang.String dumpAsXml()
Config
as XML into a buffer.boolean getBool(java.lang.String section, java.lang.String key, boolean defaultValue)
float getDefaultFloat(java.lang.String section, java.lang.String key, float defaultValue)
int getDefaultInt(java.lang.String section, java.lang.String key, int defaultValue)
int getDefaultInt64(java.lang.String section, java.lang.String key, int defaultValue)
java.lang.String getDefaultString(java.lang.String section, java.lang.String key, java.lang.String defaultValue)
float getFloat(java.lang.String section, java.lang.String key, float defaultValue)
int getInt(java.lang.String section, java.lang.String key, int defaultValue)
int getInt64(java.lang.String section, java.lang.String key, int defaultValue)
boolean getOverwriteFlagForEntry(java.lang.String section, java.lang.String key)
boolean getOverwriteFlagForSection(java.lang.String section)
java.lang.String getSectionParamString(java.lang.String section, java.lang.String key, java.lang.String defaultValue)
boolean getSkipFlagForEntry(java.lang.String section, java.lang.String key)
boolean getSkipFlagForSection(java.lang.String section)
java.lang.String getString(java.lang.String section, java.lang.String key, java.lang.String defaultString)
java.lang.String[] getStringList(java.lang.String section, java.lang.String key, java.lang.String[] defaultList)
defaultList
- A list of const char * objects. const char *int hasEntry(java.lang.String section, java.lang.String key)
key
- int hasSection(java.lang.String section)
java.lang.String loadFromXmlFile(java.lang.String filename)
Config
with the read config
dynamic values.filename
- The filename of the config file to read to fill the Config
int loadFromXmlString(java.lang.String buffer)
Config
with the read config
dynamic values.buffer
- The string of the config file to fill the Config
int readFile(java.lang.String filename)
Config
with the read config
values.filename
- The filename of the config file to read to fill the Config
boolean relativeFileExists(java.lang.String filename)
void reload()
void setBool(java.lang.String section, java.lang.String key, boolean value)
void setFloat(java.lang.String section, java.lang.String key, float value)
void setInt(java.lang.String section, java.lang.String key, int value)
void setInt64(java.lang.String section, java.lang.String key, int value)
void setIntHex(java.lang.String section, java.lang.String key, int value)
void setOverwriteFlagForEntry(java.lang.String section, java.lang.String key, boolean value)
void setOverwriteFlagForSection(java.lang.String section, boolean value)
void setRange(java.lang.String section, java.lang.String key, int minValue, int maxValue)
void setSkipFlagForEntry(java.lang.String section, java.lang.String key, boolean value)
void setSkipFlagForSection(java.lang.String section, boolean value)
void setString(java.lang.String section, java.lang.String key, java.lang.String value)
void setStringList(java.lang.String section, java.lang.String key, java.lang.String[] value)
value
- A list of const char * objects. const char * The value to setint sync()
void writeRelativeFile(java.lang.String filename, java.lang.String data)
data
- String to writeConfig newFromBuffer(java.lang.String buffer)
Config
object from a user provided buffer.
The caller of this constructor owns a reference. linphone_config_unref must be
called when this object is no longer needed.buffer
- the buffer from which the Config
will be retrieved. We
expect the buffer to be null-terminated.
See also: linphone_config_new_with_factory
See also: linphone_config_newConfig newWithFactory(java.lang.String configFilename, java.lang.String factoryConfigFilename)
Config
object from a user config file and a factory
config file.
The caller of this constructor owns a reference. linphone_config_unref must be
called when this object is no longer needed.factoryConfigFilename
- the filename of the factory config file to read to
fill the instantiated Config
See also: linphone_config_new
The user config file is read first to fill the Config
and then the
factory config file is read. Therefore the configuration parameters defined in
the user config file will be overwritten by the parameters defined in the
factory config file.void setUserData(java.lang.Object data)
data
- the object to storejava.lang.Object getUserData()