- All Known Implementing Classes:
SAMv1Handler, SAMv2Handler, SAMv3Handler
interface SAMStreamReceiver
Interface for sending streaming data to a SAM client.
Method Summary
All MethodsModifier and TypeMethodDescriptionvoidnotifyStreamDisconnection(int id, String result, String msg) Notify that a connection has been closed.voidnotifyStreamIncomingConnection(int id, Destination dest) Notify about a new incoming connection.voidnotifyStreamOutgoingConnection(int id, String result, String msg) Notify about a new outgoing connection.voidnotifyStreamSendBufferFree(int id) Notifies that the outwards buffer is free for writing.voidreceiveStreamBytes(int id, ByteBuffer data) Transmit a byte array from I2P to a SAM client.voidStop receiving data.voidstreamSendAnswer(int id, String result, String bufferState) Sends the result of a stream send operation.
Method Details
streamSendAnswer
Sends the result of a stream send operation.- Parameters:
id- the stream connection ID the answer belongs toresult- the result code sent to the client, such as OK or TIMEOUTbufferState- state of the buffer- Throws:
IOException- if writing to the client socket fails
notifyStreamSendBufferFree
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
Notify about a new incoming connection.- Parameters:
id- New connection iddest- Destination sent to the client in base64 form- Throws:
IOException- if writing to the client socket fails
notifyStreamOutgoingConnection
Notify about a new outgoing connection.- Parameters:
id- New connection idresult- status code sent in the STREAM STATUS replymsg- Message, may be null- Throws:
IOException- if writing to the client socket fails
receiveStreamBytes
Transmit a byte array from I2P to a SAM client.- Parameters:
id- Connection id the bytes were received ondata- Byte array to be received- Throws:
IOException- if writing to the client socket fails
notifyStreamDisconnection
Notify that a connection has been closed.- Parameters:
id- Connection id that was closedresult- 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.