List of utility methods to do Properties to String
String | propertiesToString(final Properties p) properties To String if (p == null) { return ""; final ByteArrayOutputStream baos = new ByteArrayOutputStream(); try { p.store(baos, ""); } catch (final Exception ignored) { return new String(baos.toByteArray()); |
String | propertiesToString(final Properties properties) properties To String final StringWriter sw = new StringWriter(); final PrintWriter pw = new PrintWriter(sw); properties.list(pw); return sw.toString(); |
String | propertiesToString(Properties p) properties To String ByteArrayOutputStream outStream = new ByteArrayOutputStream(); PrintStream out = new PrintStream(outStream); for (Object key : p.keySet()) { out.println(key + "=" + p.getProperty(key.toString())); out.close(); return new String(outStream.toByteArray()); |
String | propertiesToString(Properties properties) properties To String StringWriter writer = new StringWriter(); PrintWriter out = new PrintWriter(writer); Set<Object> keys = properties.keySet(); for (Object key : keys) { out.println(key + "=" + properties.get(key)); return writer.getBuffer().toString(); |
String | propertiesToString(Properties properties) Serializes properties to String StringWriter stringWriter = new StringWriter(); String comments = Properties.class.getName(); try { properties.store(stringWriter, comments); } catch (IOException e) { throw new RuntimeException(e); stringWriter.flush(); ... |
String | propertiesToString(Properties props) Receives a Properties and converts it to a String.
StringWriter stringWriter = new StringWriter(); PrintWriter printWriter = new PrintWriter(stringWriter); props.store(printWriter, null); String s = stringWriter.toString(); s = s.substring(s.indexOf("\n") + 1); return s; |
String | propertiesToString(Properties props, String comment) Converts properties to string representation StringWriter writer = new StringWriter(); try { props.store(writer, comment); } catch (IOException e) { return writer.toString(); |