Java Utililty Methods Properties Load

List of utility methods to do Properties Load

Description

The list of methods to do Properties Load are organized into topic(s).

Method

PropertiesloadPropertiesFromString(String propertiesString)
Load properties from a string.
Properties properties = new Properties();
properties.load(new ByteArrayInputStream(propertiesString.getBytes("ISO-8859-1")));
return properties;
PropertiesloadPropertiesResources(String name)
Loads properties from all resource with the given name.
Properties rProps = new Properties();
ClassLoader loader = Thread.currentThread().getContextClassLoader();
Enumeration<URL> rEnum = loader.getResources(name);
while (rEnum.hasMoreElements()) {
    try (InputStream ins = rEnum.nextElement().openStream()) {
        rProps.load(ins);
return rProps;
voidloadSystemPropertiesFromPropertiesResource(String propertiesResourceName)
Load the specified properties file from the classpath, and add every property as a system property.
try {
    Properties props = new Properties();
    URL url = ClassLoader.getSystemResource(propertiesResourceName);
    props.load(url.openStream());
    for (Object key : props.keySet()) {
        System.setProperty((String) key, (String) props.get(key));
} catch (Throwable e) {
...