public String put(String key, List<String> commentLines, List<String> valueLines) { commentLines = new ArrayList<String>(commentLines); valueLines = new ArrayList<String>(valueLines); String escapedKey = escapeKey(key); int lastLine = valueLines.size() - 1; if (valueLines.isEmpty()) { valueLines.add(escapedKey + "="); } else if (!valueLines.get(0).trim().startsWith(escapedKey)) { valueLines.set(0, escapedKey + " = " + escapeJava(valueLines.get(0)) + (0 < lastLine? "\\": "")); } for (int i = 1; i < valueLines.size(); i++) { valueLines.set(i, escapeJava(valueLines.get(i)) + (i < lastLine? "\\": "")); } StringBuilder value = new StringBuilder(); for (String line: valueLines) { value.append(line); } this.layout.put(key, new Layout(commentLines, valueLines)); return storage.put(key, unescapeJava(value.toString())); }
} else { String val0 = valueLines.get(0); String rv0 = typed ? val0 : escapeJava(val0); if (!val0.trim().startsWith(escapedKey)) { valueLines.set(0, escapedKey + " = " + rv0 /*+ (0 < lastLine? "\\": "")*/); valueLines.set(i, typed ? val : escapeJava(val) /*+ (i < lastLine? "\\": "")*/); while (val.length() > 0 && Character.isWhitespace(val.charAt(0))) { val = val.substring(1);
} else { String val0 = valueLines.get(0); String rv0 = typed ? val0 : escapeJava(val0); if (!val0.trim().startsWith(escapedKey)) { valueLines.set(0, escapedKey + " = " + rv0 /*+ (0 < lastLine? "\\": "")*/); valueLines.set(i, typed ? val : escapeJava(val) /*+ (i < lastLine? "\\": "")*/); while (val.length() > 0 && Character.isWhitespace(val.charAt(0))) { val = val.substring(1);
} else { String val0 = valueLines.get(0); String rv0 = typed ? val0 : escapeJava(val0); if (!val0.trim().startsWith(escapedKey)) { valueLines.set(0, escapedKey + " = " + rv0 /*+ (0 < lastLine? "\\": "")*/); valueLines.set(i, typed ? val : escapeJava(val) /*+ (i < lastLine? "\\": "")*/); while (val.length() > 0 && Character.isWhitespace(val.charAt(0))) { val = val.substring(1);
/** * Writes the given property and its value. * * @param key the property key * @param value the property value * @throws java.io.IOException if an error occurs */ public void writeProperty(String key, String value) throws IOException { write(escapeKey(key)); write(" = "); write(typed ? value : escapeJava(value)); writeln(null); }
/** * Writes the given property and its value. * * @param key the property key * @param value the property value * @throws java.io.IOException if an error occurs */ public void writeProperty(String key, String value) throws IOException { write(escapeKey(key)); write(" = "); write(typed ? value : escapeJava(value)); writeln(null); }
/** * Writes the given property and its value. * * @param key the property key * @param value the property value * @throws java.io.IOException if an error occurs */ public void writeProperty(String key, String value) throws IOException { write(escapeKey(key)); write(" = "); write(escapeJava(value)); writeln(null); }
/** * Writes the given property and its value. * * @param key the property key * @param value the property value * @throws java.io.IOException if an error occurs */ public void writeProperty(String key, String value) throws IOException { write(escapeKey(key)); write(" = "); write(typed ? value : escapeJava(value)); writeln(null); }