tags:

views:

55

answers:

1

What is the correct way to "empty" a StringWriter in Java so that I can reuse the StringWriter without having to create a new one? Neither StringWriter.flush() nor StringWriter.close() seem to have the desired effect.

+3  A: 

How about calling getBuffer().setLength(0)?

Jon Skeet