in src/main/java/org/apache/commons/configuration2/INIConfiguration.java [403:431]
public void write(final Writer writer) throws ConfigurationException, IOException {
final PrintWriter out = new PrintWriter(writer);
boolean first = true;
final String separator = getSeparatorUsedInOutput();
beginRead(false);
try {
for (final ImmutableNode node : getModel().getNodeHandler().getRootNode().getChildren()) {
if (isSectionNode(node)) {
if (!first) {
out.println();
}
out.print("[");
out.print(node.getNodeName());
out.print("]");
out.println();
node.forEach(child -> writeProperty(out, child.getNodeName(), child.getValue(), separator));
} else {
writeProperty(out, node.getNodeName(), node.getValue(), separator);
}
first = false;
}
out.println();
out.flush();
} finally {
endRead();
}
}