Package org.codehaus.groovy.runtime
Class StringBufferWriter
- java.lang.Object
- 
- java.io.Writer
- 
- org.codehaus.groovy.runtime.StringBufferWriter
 
 
- 
- All Implemented Interfaces:
- Closeable,- Flushable,- Appendable,- AutoCloseable
 
 public class StringBufferWriter extends Writer This class codes around a silly limitation 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.
- 
- 
Constructor SummaryConstructors Constructor Description StringBufferWriter(StringBuffer buffer)Create a new string writer which will append the text to the given StringBuffer
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closing a StringWriter has no effect.voidflush()Flush the stream.StringtoString()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(String text)Write a string.voidwrite(String text, int offset, int length)Write a portion of a string.
 
- 
- 
- 
Constructor Detail- 
StringBufferWriterpublic StringBufferWriter(StringBuffer buffer) Create a new string writer which will append the text to the given StringBuffer
 
- 
 - 
Method Detail- 
writepublic void write(char[] text, int offset, int length)Write a portion of an array of characters.
 - 
writepublic void write(String text, int offset, int length) Write a portion of a string.
 - 
toStringpublic String toString() Return the buffer's current value as a string.
 - 
flushpublic void flush() Flush the stream.
 - 
closepublic void close() throws IOExceptionClosing 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 interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Specified by:
- closein class- Writer
- Throws:
- IOException
 
 
- 
 
-