I noticed that StringWriter uses internally StringBuffer. But if you don't need this synchronization overhead, is there an equivalent StringWriter that uses StringBuilder inside?
If you are using Apache Commons IO, you can reuse StringBuilderWriter, which is described as follows:
Writer implementation that outputs to StringBuilder.. , java.io.StringWriter, ( ) . java.io.StringWriter.
Writer implementation that outputs to StringBuilder.
. , java.io.StringWriter, ( ) . java.io.StringWriter.
, , , .
, , StringBuilder java API ( 7, 8).
StringBuilder
, , . , StringWriter , StringBuilder, , . , , .
StringWriter