How do you “empty” a StringWriter in Java? May 28, 2023 by Tarik How about calling getBuffer().setLength(0)?