org.apache.struts2.util

## Class FastByteArrayOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.apache.struts2.util.FastByteArrayOutputStream

- All Implemented Interfaces:
    Closeable, Flushable, AutoCloseable

      public class FastByteArrayOutputStream
      extends OutputStream

  A speedy implementation of ByteArrayOutputStream. It's not synchronized, and it does not copy buffers when it's expanded. There's also no copying of the internal buffer if it's contents is extracted with the writeTo(stream) method.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FastByteArrayOutputStream()`
    `FastByteArrayOutputStream(int blockSize)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `addBuffer()`
    `void` | `close()`
    `int` | `getSize()`
    `byte[]` | `toByteArray()`
    `String` | `toString()`
    `void` | `write(byte[] data, int offset, int length)`
    `void` | `write(int datum)`
    `void` | `writeTo(javax.servlet.jsp.JspWriter out, String encoding)` This is a patched method (standard)
    `void` | `writeTo(OutputStream out)`
    `void` | `writeTo(RandomAccessFile out)`
    `void` | `writeTo(Writer out, String encoding)` This is a patched method (added for common Writer, needed for tests)

    - ### Methods inherited from class java.io.OutputStream

      `flush, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### FastByteArrayOutputStream

          public FastByteArrayOutputStream()

    - #### FastByteArrayOutputStream

          public FastByteArrayOutputStream(int blockSize)

  - ### Method Detail

    - #### writeTo

          public void writeTo(OutputStream out)
                       throws IOException

      Throws:
        `IOException`

    - #### writeTo

          public void writeTo(RandomAccessFile out)
                       throws IOException

      Throws:
        `IOException`

    - #### writeTo

          public void writeTo(Writer out,
                              String encoding)
                       throws IOException

      This is a patched method (added for common Writer, needed for tests)
      Parameters:
        `out` - Writer
        `encoding` - Encoding
      Throws:
        `IOException` - If some output failed

    - #### writeTo

          public void writeTo(javax.servlet.jsp.JspWriter out,
                              String encoding)
                       throws IOException

      This is a patched method (standard)
      Parameters:
        `out` - Writer
        `encoding` - Encoding
      Throws:
        `IOException` - If some output failed

    - #### getSize

          public int getSize()

    - #### toByteArray

          public byte[] toByteArray()

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### addBuffer

          protected void addBuffer()

    - #### write

          public void write(int datum)
                     throws IOException

      Specified by:
        `write` in class `OutputStream`
      Throws:
        `IOException`

    - #### write

          public void write(byte[] data,
                            int offset,
                            int length)
                     throws IOException

      Overrides:
        `write` in class `OutputStream`
      Throws:
        `IOException`

    - #### close

          public void close()

      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Overrides:
        `close` in class `OutputStream`

Copyright © 2000–2022 Apache Software Foundation. All rights reserved.