org.eclipse.net4j.buffer

## Class BufferOutputStream

- java.lang.Object
- - java.io.OutputStream
  - - org.eclipse.net4j.buffer.BufferOutputStream

- All Implemented Interfaces:
    java.io.Closeable, java.io.Flushable, java.lang.AutoCloseable
  Direct Known Subclasses:
    ChannelOutputStream

      public class BufferOutputStream
      extends java.io.OutputStream

  An `output stream` that fragments the written byte sequence into fixed-sized `buffers` and passes them to configured `buffer handler`.
  Author:
    Eike Stepper

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `DEFAULT_PROPAGATE_CLOSE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferOutputStream(IBufferHandler bufferHandler, IBufferProvider bufferProvider, short channelID)`
    `BufferOutputStream(IBufferHandler bufferHandler, short channelID)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected void` | `ensureBuffer()` Ensures that this BufferOutputStream has a buffer.
    `void` | `flush()` Flushes the current buffer, it's handled over to the buffer handler.
    `void` | `flushWithEOS()`
    `void` | `flushWithEOS(boolean ccam)`
    `java.lang.Throwable` | `getError()`
    `protected boolean` | `isPropagateClose()`
    `void` | `setError(java.lang.Throwable error)`
    `java.lang.String` | `toString()`
    `void` | `write(int b)`

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

      `write, write`

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

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

- - ### Field Detail

    - #### DEFAULT_PROPAGATE_CLOSE

          public static final boolean DEFAULT_PROPAGATE_CLOSE

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BufferOutputStream

          public BufferOutputStream(IBufferHandler bufferHandler,
                                    IBufferProvider bufferProvider,
                                    short channelID)

    - #### BufferOutputStream

          public BufferOutputStream(IBufferHandler bufferHandler,
                                    short channelID)

  - ### Method Detail

    - #### getError

          public java.lang.Throwable getError()

      Since:
        2.0

    - #### setError

          public void setError(java.lang.Throwable error)

      Since:
        2.0

    - #### write

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

      Specified by:
        `write` in class `java.io.OutputStream`
      Throws:
        `java.io.IOException`

    - #### flush

          public void flush()
                     throws java.io.IOException

      Flushes the current buffer, it's handled over to the buffer handler.
      Specified by:
        `flush` in interface `java.io.Flushable`
      Overrides:
        `flush` in class `java.io.OutputStream`
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.
      See Also:
        `currentBuffer`, `IBufferHandler.handleBuffer(IBuffer)`

    - #### flushWithEOS

          public void flushWithEOS()
                            throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### flushWithEOS

          public void flushWithEOS(boolean ccam)
                            throws java.io.IOException

      Throws:
        `java.io.IOException`
      Since:
        4.4

    - #### close

          public void close()
                     throws java.io.IOException

      Specified by:
        `close` in interface `java.io.Closeable`
      Specified by:
        `close` in interface `java.lang.AutoCloseable`
      Overrides:
        `close` in class `java.io.OutputStream`
      Throws:
        `java.io.IOException`

    - #### toString

          public java.lang.String toString()

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

    - #### ensureBuffer

          protected void ensureBuffer()
                               throws java.io.IOException

      Ensures that this BufferOutputStream has a buffer. If the current buffer was flushed a new one is fetched from the buffer provider.
      Throws:
        `java.io.IOException` - Signals that an I/O exception has occurred.
      See Also:
        `flush()`, `IBufferProvider.provideBuffer()`

    - #### isPropagateClose

          protected boolean isPropagateClose()

Copyright (c) 2004-2019 Eike Stepper (Loehne, Germany) and others.
All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html