org.eclipse.net4j.buffer

## Class BufferInputStream

- java.lang.Object
- - java.io.InputStream
  - - org.eclipse.net4j.buffer.BufferInputStream

- All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, IBufferHandler
  Direct Known Subclasses:
    ChannelInputStream

      public class BufferInputStream
      extends java.io.InputStream
      implements IBufferHandler

  A `buffer handler` that defragments the passed `buffers` into a continuous byte sequence which is exposed as an `input stream`.
  Author:
    Eike Stepper

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static long` | `DEFAULT_MILLIS_BEFORE_TIMEOUT`
    `static long` | `DEFAULT_MILLIS_INTERRUPT_CHECK`
    `static long` | `NO_TIMEOUT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BufferInputStream()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()`
    `protected void` | `closeChannel()` Subclasses may override.
    `protected boolean` | `ensureBuffer()`
    `java.lang.RuntimeException` | `getException()`
    `long` | `getMillisBeforeTimeout()`
    `long` | `getMillisInterruptCheck()`
    `void` | `handleBuffer(IBuffer buffer)` Handles an `IBuffer` and optionally releases it.
    `boolean` | `isCCAM()`
    `int` | `read()`
    `void` | `restartTimeout()`
    `void` | `setException(RemoteException exception)`
    `java.lang.String` | `toString()`

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

      `available, mark, markSupported, read, read, reset, skip`

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

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

- - ### Field Detail

    - #### NO_TIMEOUT

          public static final long NO_TIMEOUT

      See Also:
        Constant Field Values

    - #### DEFAULT_MILLIS_BEFORE_TIMEOUT

          public static final long DEFAULT_MILLIS_BEFORE_TIMEOUT

      See Also:
        Constant Field Values

    - #### DEFAULT_MILLIS_INTERRUPT_CHECK

          public static final long DEFAULT_MILLIS_INTERRUPT_CHECK

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### BufferInputStream

          public BufferInputStream()

  - ### Method Detail

    - #### isCCAM

          public boolean isCCAM()

      Since:
        4.4

    - #### getMillisBeforeTimeout

          public long getMillisBeforeTimeout()

    - #### getMillisInterruptCheck

          public long getMillisInterruptCheck()

    - #### restartTimeout

          public void restartTimeout()

      Since:
        2.0

    - #### getException

          public java.lang.RuntimeException getException()

      Since:
        2.0

    - #### setException

          public void setException(RemoteException exception)

      Since:
        4.0

    - #### handleBuffer

          public void handleBuffer(IBuffer buffer)

      Description copied from interface: `IBufferHandler`
      Handles an `IBuffer` and optionally releases it. The implementor of this method takes over the ownership of the buffer. Care must be taken to properly `release` the buffer if the ownership is not explicitly passed to some further party.
      Specified by:
        `handleBuffer` in interface `IBufferHandler`
      Parameters:
        `buffer` - The buffer to be handled and otionally released.

    - #### read

          public int read()
                   throws java.io.IOException

      Specified by:
        `read` in class `java.io.InputStream`
      Throws:
        `java.io.IOException`

    - #### 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.InputStream`
      Throws:
        `java.io.IOException`

    - #### toString

          public java.lang.String toString()

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

    - #### ensureBuffer

          protected boolean ensureBuffer()
                                  throws java.io.IOException

      Throws:
        `java.io.IOException`

    - #### closeChannel

          protected void closeChannel()

      Subclasses may override.
      Since:
        4.5

Copyright (c) 2014 Eike Stepper (Berlin, 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