net.i2p.sam
Interface SAMStreamReceiver

All Known Implementing Classes:
SAMv1Handler, SAMv2Handler, SAMv3Handler

public interface SAMStreamReceiver

Interface for sending streaming data to a SAM client


Method Summary
 void notifyStreamDisconnection(int id, java.lang.String result, java.lang.String msg)
          Notify that a connection has been closed FIXME: this interface should be cleaner
 void notifyStreamIncomingConnection(int id, Destination dest)
          Notify about a new incoming connection
 void notifyStreamOutgoingConnection(int id, java.lang.String result, java.lang.String msg)
          Notify about a new outgoing connection
 void notifyStreamSendBufferFree(int id)
          Notifies that the outwards buffer is free for writing
 void receiveStreamBytes(int id, java.nio.ByteBuffer data)
          Transmit a byte array from I2P to a SAM client.
 void stopStreamReceiving()
          Stop receiving data.
 void streamSendAnswer(int id, java.lang.String result, java.lang.String bufferState)
          Sends the result of a stream send operation
 

Method Detail

streamSendAnswer

void streamSendAnswer(int id,
                      java.lang.String result,
                      java.lang.String bufferState)
                      throws java.io.IOException
Sends the result of a stream send operation

Parameters:
id - Stream ID
result - information
bufferState - state of the buffer
Throws:
java.io.IOException

notifyStreamSendBufferFree

void notifyStreamSendBufferFree(int id)
                                throws java.io.IOException
Notifies that the outwards buffer is free for writing

Parameters:
id - stream ID
Throws:
java.io.IOException

notifyStreamIncomingConnection

void notifyStreamIncomingConnection(int id,
                                    Destination dest)
                                    throws java.io.IOException
Notify about a new incoming connection

Parameters:
id - New connection id
dest - Destination
Throws:
java.io.IOException

notifyStreamOutgoingConnection

void notifyStreamOutgoingConnection(int id,
                                    java.lang.String result,
                                    java.lang.String msg)
                                    throws java.io.IOException
Notify about a new outgoing connection

Parameters:
id - New connection id
result - message result
msg - Message
Throws:
java.io.IOException

receiveStreamBytes

void receiveStreamBytes(int id,
                        java.nio.ByteBuffer data)
                        throws java.io.IOException
Transmit a byte array from I2P to a SAM client.

Parameters:
id - Connection id
data - Byte array to be received
Throws:
java.io.IOException

notifyStreamDisconnection

void notifyStreamDisconnection(int id,
                               java.lang.String result,
                               java.lang.String msg)
                               throws java.io.IOException
Notify that a connection has been closed FIXME: this interface should be cleaner

Parameters:
id - Connection id
result - Disconnection reason ("OK" or something else)
msg - Error message, if any
Throws:
java.io.IOException

stopStreamReceiving

void stopStreamReceiving()
Stop receiving data.