Package i5.las2peer.tools.helper
Class ConfigFile
java.lang.Object
i5.las2peer.tools.helper.ConfigFile
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionGets a keyed value from the global section.Gets a keyed value from the given section.getAll()
Gets all non keyed values from the global section.Gets all non keyed values from the given section.boolean
hasSection
(String sectionName) Checks if a section with the given name exists.void
If value isnull
, nothing is addded If key is empty ornull
, just the value is added If a value for the given key already exists, the value is overwritten If the value has type Iterable, all elements are added to the section with key as name An existing section with that name is overwritten, except no name is given (global section)!void
store
(OutputStream os) Writes this configuration to the given output stream.
-
Constructor Details
-
ConfigFile
public ConfigFile() -
ConfigFile
- Throws:
IOException
-
ConfigFile
- Throws:
IOException
-
-
Method Details
-
put
If value isnull
, nothing is addded If key is empty ornull
, just the value is added If a value for the given key already exists, the value is overwritten If the value has type Iterable, all elements are added to the section with key as name An existing section with that name is overwritten, except no name is given (global section)!- Parameters:
key
-value
-
-
get
Gets a keyed value from the global section.- Parameters:
key
- The key to identify the value.- Returns:
- Returns the value or
null
, if the key is unknown.
-
get
Gets a keyed value from the given section.- Parameters:
sectionName
- The name of the section.key
- The key to identify the value.- Returns:
- Returns the value or
null
, if the key is unknown.
-
getAll
Gets all non keyed values from the global section.- Returns:
- Returns a list of values or an empty list.
-
getAll
Gets all non keyed values from the given section.- Parameters:
sectionName
- The name of the section.- Returns:
- Returns a list of values or
null
, if no such section exists.
-
store
Writes this configuration to the given output stream.- Parameters:
os
- The output stream to write to.- Throws:
IOException
- If writing to the stream fails.
-
hasSection
Checks if a section with the given name exists.- Parameters:
sectionName
- The section name to check.- Returns:
- Returns
true
, if a section with the given name exists, false otherwise.
-