Package org.codehaus.groovy.runtime
Class StringBufferWriter
- java.lang.Object
- 
- java.io.Writer
- 
- org.codehaus.groovy.runtime.StringBufferWriter
 
 
- 
- All Implemented Interfaces:
- java.io.Closeable,- java.io.Flushable,- java.lang.Appendable,- java.lang.AutoCloseable
 
 public class StringBufferWriter extends java.io.WriterThis 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(java.lang.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.java.lang.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(java.lang.String text)Write a string.voidwrite(java.lang.String text, int offset, int length)Write a portion of a string.
 
- 
- 
- 
Method Detail- 
writepublic void write(int c) Write a single character.- Overrides:
- writein class- java.io.Writer
 
 - 
writepublic void write(char[] text, int offset, int length)Write a portion of an array of characters.- Specified by:
- writein class- java.io.Writer
- Parameters:
- text- Array of characters
- offset- Offset from which to start writing characters
- length- Number of characters to write
 
 - 
writepublic void write(java.lang.String text) Write a string.- Overrides:
- writein class- java.io.Writer
 
 - 
writepublic void write(java.lang.String text, int offset, int length)Write a portion of a string.- Overrides:
- writein class- java.io.Writer
- Parameters:
- text- the text to be written
- offset- offset from which to start writing characters
- length- Number of characters to write
 
 - 
toStringpublic java.lang.String toString() Return the buffer's current value as a string.- Overrides:
- toStringin class- java.lang.Object
 
 - 
flushpublic void flush() Flush the stream.- Specified by:
- flushin interface- java.io.Flushable
- Specified by:
- flushin class- java.io.Writer
 
 - 
closepublic void close() throws java.io.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- java.lang.AutoCloseable
- Specified by:
- closein interface- java.io.Closeable
- Specified by:
- closein class- java.io.Writer
- Throws:
- java.io.IOException
 
 
- 
 
-