A character stream that collects its output in a string buffer, which can then be used to construct a string. <p> Closing a {@code StringWriter} has no effect. The methods in this class can be called after the stream has been closed without generating an {@code IOException}.