Overview | Package | Class | Deprecated | Index | Help
| Groovy 1.7.10
| FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

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

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

    public class StringBufferWriter
    extends 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 bizzare reason. So we replicate the behaviour of StringWriter here but allow a StringBuffer to be passed in.

Authors:
  James Strachan

Version:
  \$Revision: 6778 \$

Constructor Summary
`StringBufferWriter(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.
`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(String text)` Write a string.
`void` | `write(String text, int offset, int length)` Write a portion of a string.

Methods inherited from class Writer
append, append, append, append, append, append, write, write, write, write, write, close, flush, wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Methods inherited from class Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll

Constructor Detail

### StringBufferWriter

    public StringBufferWriter(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 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(String text)

  Write a string.

### write

    public void write(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

Copyright © 2003-2010 The Codehaus. All rights reserved.