Package com.google.android.exoplayer2.util

## Class ReusableBufferedOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - java.io.FilterOutputStream
    - - java.io.BufferedOutputStream
      - - com.google.android.exoplayer2.util.ReusableBufferedOutputStream

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

      public final class ReusableBufferedOutputStream
      extends BufferedOutputStream

  This is a subclass of `BufferedOutputStream` with a `reset(OutputStream)` method that allows an instance to be re-used with another underlying output stream.

- - ### Field Summary

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

      `buf, count`

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

      `out`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ReusableBufferedOutputStream​(OutputStream out)` |
    `ReusableBufferedOutputStream​(OutputStream out, int size)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `close()` |
    `void` | `reset​(OutputStream out)` | Resets this stream and uses the given output stream for writing.

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

      `flush, write, write`

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

      `write`

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

      `nullOutputStream`

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

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

- - ### Constructor Detail

    - #### ReusableBufferedOutputStream

          public ReusableBufferedOutputStream​(OutputStream out)

    - #### ReusableBufferedOutputStream

          public ReusableBufferedOutputStream​(OutputStream out,
                                              int size)

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

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

    - #### reset

          public void reset​(OutputStream out)

      Resets this stream and uses the given output stream for writing. This stream must be closed before resetting.
      Parameters:
        `out` - New output stream to be used for writing.
      Throws:
        `IllegalStateException` - If the stream isn't closed.