Class StringBufferWriter
java.lang.Object
java.io.Writer
org.codehaus.groovy.runtime.StringBufferWriter
- All Implemented Interfaces:
Closeable, Flushable, Appendable, AutoCloseable
This class codes around a silly limiation of StringWriter which doesn't allow a StringBuffer
to be passed in as a constructor for some bizarre reason.
So we replicate the behaviour of StringWriter here but allow a StringBuffer to be passed in.
- Version:
- $Revision$
- Author:
- James Strachan
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionStringBufferWriter(StringBuffer buffer) Create a new string writer which will append the text to the given StringBuffer -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Closing a StringWriter has no effect.voidflush()Flush the stream.toString()Return the buffer's current value as a string.voidwrite(char[] text, int offset, int length) Write a portion of an array of characters.voidwrite(int c) Write a single character.voidWrite a string.voidWrite a portion of a string.
-
Constructor Details
-
StringBufferWriter
Create a new string writer which will append the text to the given StringBuffer
-
-
Method Details
-
write
-
write
-
write
-
write
-
toString
-
flush
-
close
Closing a StringWriter has no effect. The methods in this class can be called after the stream has been closed without generating an IOException.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein classWriter- Throws:
IOException
-