All Known Implementing Classes:
SAMv1Handler, SAMv2Handler, SAMv3Handler

interface SAMStreamReceiver
Interface for sending streaming data to a SAM client.
  • Method Details

    • streamSendAnswer

      void streamSendAnswer(int id, String result, String bufferState) throws IOException
      Sends the result of a stream send operation.
      Parameters:
      id - the stream connection ID the answer belongs to
      result - the result code sent to the client, such as OK or TIMEOUT
      bufferState - state of the buffer
      Throws:
      IOException - if writing to the client socket fails
    • notifyStreamSendBufferFree

      void notifyStreamSendBufferFree(int id) throws IOException
      Notifies that the outwards buffer is free for writing.
      Parameters:
      id - the stream connection ID whose send buffer has drained
      Throws:
      IOException - if writing to the client socket fails
    • notifyStreamIncomingConnection

      void notifyStreamIncomingConnection(int id, Destination dest) throws IOException
      Notify about a new incoming connection.
      Parameters:
      id - New connection id
      dest - Destination sent to the client in base64 form
      Throws:
      IOException - if writing to the client socket fails
    • notifyStreamOutgoingConnection

      void notifyStreamOutgoingConnection(int id, String result, String msg) throws IOException
      Notify about a new outgoing connection.
      Parameters:
      id - New connection id
      result - status code sent in the STREAM STATUS reply
      msg - Message, may be null
      Throws:
      IOException - if writing to the client socket fails
    • receiveStreamBytes

      void receiveStreamBytes(int id, ByteBuffer data) throws IOException
      Transmit a byte array from I2P to a SAM client.
      Parameters:
      id - Connection id the bytes were received on
      data - Byte array to be received
      Throws:
      IOException - if writing to the client socket fails
    • notifyStreamDisconnection

      void notifyStreamDisconnection(int id, String result, String msg) throws IOException
      Notify that a connection has been closed.
      Parameters:
      id - Connection id that was closed
      result - Disconnection reason ("OK" or something else)
      msg - Error message, if any
      Throws:
      IOException - if writing to the client socket fails
    • stopStreamReceiving

      void stopStreamReceiving()
      Stop receiving data.