Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javolution.io
Class AppendableWriter

    java.lang.Object
      java.io.Writer
          javolution.io.AppendableWriter

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

    public final class AppendableWriter

extends java.io.Writer
implements Reusable

This class allows any `Appendable` to be used as a writer.

Version:
  3.8, May 8, 2006
Author:
  Jean-Marie Dautelle

Field Summary

Fields inherited from class java.io.Writer
`lock`

Constructor Summary
`AppendableWriter()` Creates a new appendable writer for which the appendable output is not set.

Method Summary
`void` | `close()` Closes and `resets` this writer for reuse.
`void` | `flush()` Flushes the stream.
`void` | `reset()` Resets the internal state of this object to its default values.
`AppendableWriter` | `setOutput(java.lang.Appendable output)` Sets the appendable output being written to.
`void` | `write(char c)` Writes a single character.
`void` | `write(char[] cbuf, int off, int len)` Writes a portion of an array of characters.
`void` | `write(java.lang.CharSequence csq)` Writes the specified character sequence.
`void` | `write(int c)` Writes the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.
`void` | `write(java.lang.String str, int off, int len)` Writes a portion of a string.

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

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

Constructor Detail

### AppendableWriter

    public AppendableWriter()

  Creates a new appendable writer for which the appendable output is not set.

  See Also:
    `setOutput(Appendable)`

Method Detail

### setOutput

    public AppendableWriter setOutput(java.lang.Appendable output)

  Sets the appendable output being written to. For example:`

           Writer writer = new AppendableWriter().setOutput(new TextBuilder());

  `

  Parameters:
    `output` - the appendable written to.
  Returns:
    this writer.
  Throws:
    `java.lang.IllegalStateException` - if this writer is being reused and it has not been `closed` or `reset`.

### write

    public void write(char c)
               throws java.io.IOException

  Writes a single character.

  Parameters:
    `c` - `char` the character to be written.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### write

    public void write(int c)
               throws java.io.IOException

  Writes the 16 low-order bits of the given integer value; the 16 high-order bits are ignored.

  Overrides:
    `write` in class `java.io.Writer`
  Parameters:
    `c` - the value of the character to be written.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### write

    public void write(char[] cbuf,
                      int off,
                      int len)
               throws java.io.IOException

  Writes a portion of an array of characters.

  Specified by:
    `write` in class `java.io.Writer`
  Parameters:
    `cbuf` - the array of characters.
    `off` - the offset from which to start writing characters.
    `len` - the number of characters to write.
  Throws:
    `java.io.IOException` - if an I/O error occurs.

### write

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

  Writes a portion of a string.

  Overrides:
    `write` in class `java.io.Writer`
  Parameters:
    `str` - a String.
    `off` - the offset from which to start writing characters.
    `len` - the number of characters to write.
  Throws:
    `java.io.IOException` - if an I/O error occurs

### write

    public void write(java.lang.CharSequence csq)
               throws java.io.IOException

  Writes the specified character sequence.

  Parameters:
    `csq` - the character sequence.
  Throws:
    `java.io.IOException` - if an I/O error occurs

### flush

    public void flush()

  Flushes the stream.

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

### close

    public void close()

  Closes and `resets` this writer for reuse.

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

### reset

    public void reset()

  Description copied from interface: `Reusable`
  Resets the internal state of this object to its default values.

  Specified by:
    `reset` in interface `Reusable`

Overview | Package | Class | Tree | Deprecated | Index | Help
| J avolution v5.2 (J2SE 1.5+)
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2005 - 2007 Javolution.