## org.eclipse.datatools.sqltools.common.ui.util
Class StringBufferWriter

    java.lang.Object
      java.io.Writer
          org.eclipse.datatools.sqltools.common.ui.util.StringBufferWriter

All Implemented Interfaces:
  java.io.Closeable, java.io.Flushable, java.lang.Appendable

    public class StringBufferWriter

extends java.io.Writer

This class mainly duplicate the java.io.StringWriter function. But allow the underlying StringBuffer to be passed in as parameter.

Author:
  Yang Liu

Constructor Summary
`StringBufferWriter(java.lang.StringBuffer buffer)` Create a new string writer, using the default initial string-buffer size.

Method Summary
`void` `close()` Closing a `StringWriter` has no effect.
`void` `flush()` Flush the stream.
`java.lang.StringBuffer` `getBuffer()` Return the string buffer itself.
`java.lang.String` `toString()` Return the buffer's current value as a string.
`void` `write(char[] cbuf, int off, int len)` Write a portion of an array of characters.
`void` `write(int c)` Write a single character.
`void` `write(java.lang.String str)` Write a string.
`void` `write(java.lang.String str, int off, int len)` Write a portion of a string.

Methods inherited from class java.io.Writer
`append, append, append, write`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### StringBufferWriter

    public StringBufferWriter(java.lang.StringBuffer buffer)

  Create a new string writer, using the default initial string-buffer size.

Method Detail

### write

    public void write(int c)

  Write a single character.

  Overrides:
    `write` in class `java.io.Writer`

### write

    public void write(char[] cbuf,
                      int off,
                      int len)

  Write a portion of an array of characters.

  Specified by:
    `write` in class `java.io.Writer`
  Parameters:
    `cbuf` - Array of characters
    `off` - Offset from which to start writing characters
    `len` - Number of characters to write

### write

    public void write(java.lang.String str)

  Write a string.

  Overrides:
    `write` in class `java.io.Writer`

### write

    public void write(java.lang.String str,
                      int off,
                      int len)

  Write a portion of a string.

  Overrides:
    `write` in class `java.io.Writer`
  Parameters:
    `str` - String to be written
    `off` - Offset from which to start writing characters
    `len` - Number of characters to write

### toString

    public java.lang.String toString()

  Return the buffer's current value as a string.

  Overrides:
    `toString` in class `java.lang.Object`

### getBuffer

    public java.lang.StringBuffer getBuffer()

  Return the string buffer itself.

  Returns:
    StringBuffer holding the current buffer value.

### flush

    public void flush()

  Flush the stream.

  Specified by:
    `flush` in interface `java.io.Flushable`
  Specified by:
    `flush` in class `java.io.Writer`

### 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`.

  Specified by:
    `close` in interface `java.io.Closeable`
  Specified by:
    `close` in class `java.io.Writer`