Package jodd.util
Class PropertiesUtil
java.lang.Object
jodd.util.PropertiesUtil
Misc java.util.Properties utils.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PropertiescreateFromFile(File file) Create properties from the file.static PropertiescreateFromFile(String fileName) Create properties from the file.static PropertiescreateFromString(String data) Creates properties from string.static StringgetProperty(Map map, String key) Returns String property from a map.static StringgetProperty(Map map, String key, String defaultValue) Returns String property from a map.static voidloadFromFile(Properties p, File file) Loads properties from the file.static voidloadFromFile(Properties p, String fileName) Loads properties from the file.static voidloadFromString(Properties p, String data) Loads properties from string.static voidResolves all variables.static StringresolveProperty(Map map, String key) Returns property with resolved variables.static Propertiessubset(Properties p, String prefix, boolean stripPrefix) Creates new Properties object from the original one, by copying those properties that have specified first part of the key name.static voidwriteToFile(Properties p, File file) Writes properties to a file.static voidwriteToFile(Properties p, File file, String header) Writes properties to a file.static voidwriteToFile(Properties p, String fileName) Writes properties to a file.static voidwriteToFile(Properties p, String fileName, String header) Writes properties to a file.
-
Constructor Details
-
PropertiesUtil
public PropertiesUtil()
-
-
Method Details
-
createFromFile
Create properties from the file.- Parameters:
fileName- properties file name to load- Throws:
IOException
-
createFromFile
Create properties from the file.- Parameters:
file- properties file to load- Throws:
IOException
-
loadFromFile
Loads properties from the file. Properties are appended to the existing properties object.- Parameters:
p- properties to fill infileName- properties file name to load- Throws:
IOException
-
loadFromFile
Loads properties from the file. Properties are appended to the existing properties object.- Parameters:
p- properties to fill infile- file to read properties from- Throws:
IOException
-
writeToFile
Writes properties to a file.- Parameters:
p- properties to write to filefileName- destination file name- Throws:
IOException
-
writeToFile
Writes properties to a file.- Parameters:
p- properties to write to filefileName- destination file nameheader- optional header- Throws:
IOException
-
writeToFile
Writes properties to a file.- Parameters:
p- properties to write to filefile- destination file- Throws:
IOException
-
writeToFile
Writes properties to a file.- Parameters:
p- properties to write to filefile- destination fileheader- optional header- Throws:
IOException
-
createFromString
Creates properties from string.- Throws:
IOException
-
loadFromString
Loads properties from string.- Throws:
IOException
-
subset
Creates new Properties object from the original one, by copying those properties that have specified first part of the key name. Prefix may be optionally stripped during this process.- Parameters:
p- source properties, from which new object will be createdprefix- key names prefix- Returns:
- subset properties
-
getProperty
Returns String property from a map. If key is not found, or if value is not a String, returnsnull. MimicsProperty.getPropertybut on map. -
getProperty
Returns String property from a map.- See Also:
-
resolveAllVariables
Resolves all variables. -
resolveProperty
Returns property with resolved variables.
-