Package com.biglybt.pif.messaging
Interface MessageStreamDecoder
public interface MessageStreamDecoder
Decodes a message stream into separate messages.
-
Method Summary
Modifier and TypeMethodDescriptiondestroy()
Destroy this decoder, i.e.int
Get the number of (piece) data bytes decoded from the transport, from the last decode op.int
Get the number of protocol (overhead) bytes decoded from the transport, from the last decode op.void
Pause message decoding.int
performStreamDecode
(Transport transport, int max_bytes) Decode message stream from the given transport.Message[]
Get the messages decoded from the transport, if any, from the last decode op.void
Resume message decoding.
-
Method Details
-
performStreamDecode
Decode message stream from the given transport.- Parameters:
transport
- to decode frommax_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 received
-
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
-