org.ajax4jsf.io

## Class FastBufferWriter

- java.lang.Object
- - java.io.Writer
  - - org.ajax4jsf.io.FastBufferWriter

- All Implemented Interfaces:
    Closeable, Flushable, Appendable, AutoCloseable

      public class FastBufferWriter
      extends Writer

  Class for writing to chain of char arrays extending Writer.
  Author:
    glory

- - ### Field Summary

    - ### Fields inherited from class java.io.Writer

      `lock`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FastBufferWriter()` Creates instance of default initial capacity.
    `FastBufferWriter(CharBuffer firstBuffer)` Creates instance for an already existing chain of char arrays.
    `FastBufferWriter(int initialSize)` Creates instance with required initial capacity.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `FastBufferOutputStream` | `convertToOutputStream()` Returns instance of FastBufferOutputStream containing all data written to this writer.
    `FastBufferOutputStream` | `convertToOutputStream(String encoding)` Returns instance of FastBufferOutputStream containing all data written to this writer.
    `void` | `flush()`
    `CharBuffer` | `getFirstBuffer()` Returns the first link of the chain of char arrays.
    `int` | `getLength()` Returns the total number of written chars.
    `void` | `printTo(javax.servlet.ServletOutputStream outputStream)`
    `void` | `reset()` Resets writer to empty state
    `char[]` | `toCharArray()` Writes all data written up to the moment to string buffer.
    `void` | `write(char[] cbuf)`
    `void` | `write(char[] cbuf, int off, int len)`
    `void` | `write(int c)`
    `void` | `writeTo(Writer writer)` Writes all data written up to the moment to out.

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

    - #### FastBufferWriter

          public FastBufferWriter()

      Creates instance of default initial capacity.

    - #### FastBufferWriter

          public FastBufferWriter(CharBuffer firstBuffer)

      Creates instance for an already existing chain of char arrays.
      Parameters:
        `firstBuffer` -

    - #### FastBufferWriter

          public FastBufferWriter(int initialSize)

      Creates instance with required initial capacity.
      Parameters:
        `initialSize` -

  - ### Method Detail

    - #### write

          public void write(int c)
                     throws IOException

      Overrides:
        `write` in class `Writer`
      Throws:
        `IOException`
      See Also:
        `Writer.write(int)`

    - #### write

          public void write(char[] cbuf)
                     throws IOException

      Overrides:
        `write` in class `Writer`
      Throws:
        `IOException`
      See Also:
        `Writer.write(char[])`

    - #### write

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

      Specified by:
        `write` in class `Writer`
      Throws:
        `IOException`
      See Also:
        `Writer.write(char[], int, int)`

    - #### getLength

          public int getLength()

      Returns the total number of written chars.
      Returns:
        the total number of written char

    - #### getFirstBuffer

          public CharBuffer getFirstBuffer()

      Returns the first link of the chain of char arrays.
      Returns:
        the first link of the chain of char arrays

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in class `Writer`
      Throws:
        `IOException`

    - #### flush

          public void flush()
                     throws IOException

      Specified by:
        `flush` in interface `Flushable`
      Specified by:
        `flush` in class `Writer`
      Throws:
        `IOException`

    - #### toCharArray

          public char[] toCharArray()

      Writes all data written up to the moment to string buffer.
      Throws:
        `IOException`

    - #### writeTo

          public void writeTo(Writer writer)
                       throws IOException

      Writes all data written up to the moment to out.
      Parameters:
        `writer` -
      Throws:
        `IOException`

    - #### printTo

          public void printTo(javax.servlet.ServletOutputStream outputStream)
                       throws IOException

      Throws:
        `IOException`

    - #### convertToOutputStream

          public FastBufferOutputStream convertToOutputStream(String encoding)
                                                       throws UnsupportedEncodingException

      Returns instance of FastBufferOutputStream containing all data written to this writer.
      Parameters:
        `encoding` -
      Returns:
        instance of FastBufferOutputStream containing all data written to this writer
      Throws:
        `UnsupportedEncodingException`

    - #### convertToOutputStream

          public FastBufferOutputStream convertToOutputStream()

      Returns instance of FastBufferOutputStream containing all data written to this writer.
      Returns:
        instance of FastBufferOutputStream containing all data written to this writer

    - #### reset

          public void reset()

      Resets writer to empty state
      Since:
        3.3.0

Copyright © 2015 JBoss by Red Hat. All Rights Reserved.