Java Properties object to String

It's not directly related to your question but if you just want to print out properties for debugging you can do something like this

properties.list(System.out);

There seems to be a problem with @Isiu answer. After that code Properties are truncated, like there is some limit to string length. Proper way is to use code like this:

public static String getPropertyAsString(Properties prop) { 
    StringWriter writer = new StringWriter();
    try {
        prop.store(writer, "");
    } catch (IOException e) {
        ...
    }
    return writer.getBuffer().toString();
}

public static String getPropertyAsString(Properties prop) {    
  StringWriter writer = new StringWriter();
  prop.list(new PrintWriter(writer));
  return writer.getBuffer().toString();
}