Class MessageStreamDecoderAdapter
java.lang.Object
com.biglybt.pifimpl.local.messaging.MessageStreamDecoderAdapter
- All Implemented Interfaces:
MessageStreamDecoder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondestroy()
Destroy this decoder, i.e.int[]
Get the details of the current message that is being received (read from the transport).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.
-
Field Details
-
plug_decoder
-
-
Constructor Details
-
MessageStreamDecoderAdapter
-
-
Method Details
-
performStreamDecode
Description copied from interface:MessageStreamDecoder
Decode message stream from the given transport.- Specified by:
performStreamDecode
in interfaceMessageStreamDecoder
- Parameters:
transport
- to decode frommax_bytes
- to decode/read from the stream- Returns:
- number of bytes decoded
- Throws:
IOException
- on decoding error
-
getCurrentMessageProgress
public int[] getCurrentMessageProgress()Description copied from interface:MessageStreamDecoder
Get the details of the current message that is being received (read from the transport).- Specified by:
getCurrentMessageProgress
in interfaceMessageStreamDecoder
- Returns:
- [ size, done ] or null
-
removeDecodedMessages
Description copied from interface:MessageStreamDecoder
Get the messages decoded from the transport, if any, from the last decode op.- Specified by:
removeDecodedMessages
in interfaceMessageStreamDecoder
- Returns:
- decoded messages, or null if no new complete messages were decoded
-
getProtocolBytesDecoded
public int getProtocolBytesDecoded()Description copied from interface:MessageStreamDecoder
Get the number of protocol (overhead) bytes decoded from the transport, from the last decode op.- Specified by:
getProtocolBytesDecoded
in interfaceMessageStreamDecoder
- Returns:
- number of protocol bytes received
-
getDataBytesDecoded
public int getDataBytesDecoded()Description copied from interface:MessageStreamDecoder
Get the number of (piece) data bytes decoded from the transport, from the last decode op.- Specified by:
getDataBytesDecoded
in interfaceMessageStreamDecoder
- Returns:
- number of data bytes received
-
pauseDecoding
public void pauseDecoding()Description copied from interface:MessageStreamDecoder
Pause message decoding.- Specified by:
pauseDecoding
in interfaceMessageStreamDecoder
-
resumeDecoding
public void resumeDecoding()Description copied from interface:MessageStreamDecoder
Resume message decoding.- Specified by:
resumeDecoding
in interfaceMessageStreamDecoder
-
destroy
Description copied from interface:MessageStreamDecoder
Destroy this decoder, i.e. perform cleanup.- Specified by:
destroy
in interfaceMessageStreamDecoder
- Returns:
- any bytes already-read and still remaining within the decoder
-