Java Utililty Methods Properties to

List of utility methods to do Properties to

Description

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

Method

InputStreamPropertiesToInputStream(Properties p)
Properties To Input Stream
ByteArrayOutputStream bos = null;
try {
    bos = new ByteArrayOutputStream();
    p.store(bos, "");
    return new ByteArrayInputStream(bos.toByteArray());
} catch (Exception e) {
    e.printStackTrace();
    return null;
...
byte[]propertiesToXmlByteArray(Properties p)
properties To Xml Byte Array
ByteArrayOutputStream os = new ByteArrayOutputStream();
p.storeToXML(os, null);
return (os.toByteArray());
StringtoString(Properties props)
to String
Iterator it = props.entrySet().iterator();
String s = ""; 
while (it.hasNext()) {
    Map.Entry entry = (Map.Entry) it.next();
    s += (s.length() > 0 ? "," : "") + entry.getKey() + "=" + entry.getValue(); 
return s;
StringtoStringProperties(String name, Properties props)
get String representing the given properties.
if (props == null || props.size() == 0) {
    return "Props(" + name + ") is empty\n";
StringBuffer sb = new StringBuffer();
sb.append("Props(" + name + ") is \n");
for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) {
    String key = (String) enumeration.nextElement();
    sb.append("\tkey=" + key + "\tvalue=" + props.getProperty(key) + "\n");
...