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.
StringWriter
StringWriter.flush()
StringWriter.close()
How about calling getBuffer().setLength(0)?
getBuffer().setLength(0)
2.1m questions
2.1m answers
60 comments
57.0k users