org.gudy.azureus2.plugins.messaging
Interface MessageStreamDecoder


public interface MessageStreamDecoder

Decodes a message stream into separate messages.


Method Summary
 ByteBuffer destroy()
          Destroy this decoder, i.e.
 int getDataBytesDecoded()
          Get the number of (piece) data bytes decoded from the transport, from the last decode op.
 int getProtocolBytesDecoded()
          Get the number of protocol (overhead) bytes decoded from the transport, from the last decode op.
 void pauseDecoding()
          Pause message decoding.
 int performStreamDecode(Transport transport, int max_bytes)
          Decode message stream from the given transport.
 Message[] removeDecodedMessages()
          Get the messages decoded from the transport, if any, from the last decode op.
 void resumeDecoding()
          Resume message decoding.
 

Method Detail

performStreamDecode

int performStreamDecode(Transport transport,
                        int max_bytes)
                        throws IOException
Decode message stream from the given transport.

Parameters:
transport - to decode from
max_bytes - to decode/read from the stream
Returns:
number of bytes decoded
Throws:
IOException - on decoding error

removeDecodedMessages

Message[] removeDecodedMessages()
Get the messages decoded from the transport, if any, from the last decode op.

Returns:
decoded messages, or null if no new complete messages were decoded

getProtocolBytesDecoded

int getProtocolBytesDecoded()
Get the number of protocol (overhead) bytes decoded from the transport, from the last decode op.

Returns:
number of protocol bytes recevied

getDataBytesDecoded

int getDataBytesDecoded()
Get the number of (piece) data bytes decoded from the transport, from the last decode op.

Returns:
number of data bytes received

pauseDecoding

void pauseDecoding()
Pause message decoding.


resumeDecoding

void resumeDecoding()
Resume message decoding.


destroy

ByteBuffer destroy()
Destroy this decoder, i.e. perform cleanup.

Returns:
any bytes already-read and still remaining within the decoder