Groovy Documentation

org.codehaus.groovy.runtime
[Java] Class StringBufferWriter

java.lang.Object
  java.io.Writer
      org.codehaus.groovy.runtime.StringBufferWriter

public class StringBufferWriter
extends java.io.Writer

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.

Authors:
James Strachan
Version:
\$Revision\$


Constructor Summary
StringBufferWriter(java.lang.StringBuffer buffer)

Create a new string writer which will append the text to the given StringBuffer

 
Method Summary
void close()

Closing a StringWriter has no effect.

void flush()

Flush the stream.

java.lang.String toString()

Return the buffer's current value as a string.

void write(int c)

Write a single character.

void write(char[] text, int offset, int length)

Write a portion of an array of characters.

void write(java.lang.String text)

Write a string.

void write(java.lang.String text, int offset, int length)

Write a portion of a string.

 
Methods inherited from class java.io.Writer
java.io.Writer#append(java.lang.CharSequence, int, int), java.io.Writer#append(char), java.io.Writer#append(java.lang.CharSequence), java.io.Writer#append(char), java.io.Writer#append(java.lang.CharSequence, int, int), java.io.Writer#append(java.lang.CharSequence), java.io.Writer#write([C), java.io.Writer#write([C, int, int), java.io.Writer#write(int), java.io.Writer#write(java.lang.String, int, int), java.io.Writer#write(java.lang.String), java.io.Writer#close(), java.io.Writer#flush(), java.io.Writer#wait(long, int), java.io.Writer#wait(long), java.io.Writer#wait(), java.io.Writer#equals(java.lang.Object), java.io.Writer#toString(), java.io.Writer#hashCode(), java.io.Writer#getClass(), java.io.Writer#notify(), java.io.Writer#notifyAll()
 
Methods inherited from class java.lang.Object
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll()
 

Constructor Detail

StringBufferWriter

public StringBufferWriter(java.lang.StringBuffer buffer)
Create a new string writer which will append the text to the given StringBuffer


 
Method Detail

close

public void 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.


flush

public void flush()
Flush the stream.


toString

public java.lang.String toString()
Return the buffer's current value as a string.


write

public void write(int c)
Write a single character.


write

public void write(char[] text, int offset, int length)
Write a portion of an array of characters.
Parameters:
text - Array of characters
offset - Offset from which to start writing characters
length - Number of characters to write


write

public void write(java.lang.String text)
Write a string.


write

public void write(java.lang.String text, int offset, int length)
Write a portion of a string.
Parameters:
text - the text to be written
offset - offset from which to start writing characters
length - Number of characters to write


 

Groovy Documentation