net.i2p.sam

## Class SAMStreamSession.StreamSender

- java.lang.Object
- - net.i2p.sam.SAMStreamSession.StreamSender

- All Implemented Interfaces:
    Runnable
  Enclosing class:
    SAMStreamSession

      protected abstract static class SAMStreamSession.StreamSender
      extends Object
      implements Runnable

  Lets us push data through the stream without blocking, (even after exceeding the I2PSocket's buffer)

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `_id`
    `protected I2PSocket` | `i2pSocket`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StreamSender(I2PSocket s, int id)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract void` | `run()`
    `abstract void` | `sendBytes(InputStream in, int size)` Send bytes through the SAM STREAM session socket sender
    `abstract void` | `shutDownGracefully()` Stop a SAM STREAM session socket sender gracefully: stop the sender thread once all pending data has been sent.
    `abstract void` | `stopRunning()` Stop a SAM STREAM session socket sender thread immediately

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

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

- - ### Field Detail

    - #### _id

          protected final int _id

    - #### i2pSocket

          protected final I2PSocket i2pSocket

  - ### Constructor Detail

    - #### StreamSender

          public StreamSender(I2PSocket s,
                              int id)
                       throws IOException

      Throws:
        `IOException`

  - ### Method Detail

    - #### run

          public abstract void run()

      Specified by:
        `run` in interface `Runnable`

    - #### sendBytes

          public abstract void sendBytes(InputStream in,
                                         int size)
                                  throws IOException

      Send bytes through the SAM STREAM session socket sender
      Parameters:
        `in` - Data input stream
        `size` - Count of bytes to send
      Throws:
        `IOException` - if the client didnt provide enough data

    - #### shutDownGracefully

          public abstract void shutDownGracefully()

      Stop a SAM STREAM session socket sender gracefully: stop the sender thread once all pending data has been sent.

    - #### stopRunning

          public abstract void stopRunning()

      Stop a SAM STREAM session socket sender thread immediately