List of utility methods to do Properties Load
Properties | loadPropertiesFromString(String propertiesString) Load properties from a string. Properties properties = new Properties(); properties.load(new ByteArrayInputStream(propertiesString.getBytes("ISO-8859-1"))); return properties; |
Properties | loadPropertiesResources(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; |
void | loadSystemPropertiesFromPropertiesResource(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) { ... |