Is there a StringWriter equivalent, but with StringBuilder inside Java?

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?

+4
source share
2 answers

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.

, , , .

+1

, , StringBuilder java API ( 7, 8).

, , . , StringWriter , StringBuilder, , . , , .

+2

All Articles