/** * Write the contents of this <code>XmlStringBuilder</code> to a {@link Writer}. This will write * the single parts one-by-one, avoiding allocation of a big continuous memory block holding the * XmlStringBuilder contents. * * @param writer * @throws IOException */ public void write(Writer writer) throws IOException { for (CharSequence csq : sb.getAsList()) { if (csq instanceof XmlStringBuilder) { ((XmlStringBuilder) csq).write(writer); } else { writer.write(csq.toString()); } } }