C# Class Helios.Codecs.ByteToMessageDecoder

Used for providing message framing capabilities for inbound data
Inheritance: Helios.Channels.ChannelHandlerAdapter
ファイルを表示 Open project: helios-io/helios

Public Properties

Property Type Description
Merge Cumulator

Public Methods

Method Description
ChannelInactive ( IChannelHandlerContext context ) : void
ChannelRead ( IChannelHandlerContext context, object message ) : void
ChannelReadComplete ( IChannelHandlerContext context ) : void
HandlerRemoved ( IChannelHandlerContext context ) : void
SetCumulator ( Cumulator cumulator ) : void

Set the Cumulator function used by this decoder.

SetDiscardAfterReads ( int discardAfterReads ) : void

Set the number of reads after whcih IByteBuf.DiscardSomeReadBytes are called to free up memory. The default is 16.

SetSingleDecode ( bool singleDecode ) : void

When set to true then only one message is decoded on each IChannelHandler.ChannelRead. Defaults to false for performance reasons.

May be useful if oyu need to do a protocol upgrade and want to make sure nothing is mixed up.

Protected Methods

Method Description
CallDecode ( IChannelHandlerContext context, IByteBuf input, List output ) : void
Decode ( IChannelHandlerContext context, IByteBuf input, List output ) : void
DecodeLast ( IChannelHandlerContext context, IByteBuf input, List output ) : void

Called one last time when the IChannelHandlerContext goes inactive, which means the IChannelHandler.ChannelInactive was triggered. By default this will jsut call Decode but sub-classes may override this for special cleanup operations.

DiscardSomeReadBytes ( ) : void
HandlerRemovedInternal ( IChannelHandlerContext context ) : void

Private Methods

Method Description
ChannelInputClosed ( IChannelHandlerContext context, bool callChannelInactive ) : void
ExpandCumulation ( IByteBufAllocator alloc, IByteBuf cumulation, int readable ) : IByteBuf

Expand the existing cumulative IByteBuf.

FireChannelRead ( IChannelHandlerContext context, List msgs, int numElements ) : void

Method Details

CallDecode() protected method

protected CallDecode ( IChannelHandlerContext context, IByteBuf input, List output ) : void
context IChannelHandlerContext
input IByteBuf
output List
return void

ChannelInactive() public method

public ChannelInactive ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

ChannelRead() public method

public ChannelRead ( IChannelHandlerContext context, object message ) : void
context IChannelHandlerContext
message object
return void

ChannelReadComplete() public method

public ChannelReadComplete ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

Decode() protected abstract method

protected abstract Decode ( IChannelHandlerContext context, IByteBuf input, List output ) : void
context IChannelHandlerContext
input IByteBuf
output List
return void

DecodeLast() protected method

Called one last time when the IChannelHandlerContext goes inactive, which means the IChannelHandler.ChannelInactive was triggered. By default this will jsut call Decode but sub-classes may override this for special cleanup operations.
protected DecodeLast ( IChannelHandlerContext context, IByteBuf input, List output ) : void
context IChannelHandlerContext
input IByteBuf
output List
return void

DiscardSomeReadBytes() protected method

protected DiscardSomeReadBytes ( ) : void
return void

HandlerRemoved() public method

public HandlerRemoved ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

HandlerRemovedInternal() protected method

protected HandlerRemovedInternal ( IChannelHandlerContext context ) : void
context IChannelHandlerContext
return void

SetCumulator() public method

Set the Cumulator function used by this decoder.
public SetCumulator ( Cumulator cumulator ) : void
cumulator Cumulator
return void

SetDiscardAfterReads() public method

Set the number of reads after whcih IByteBuf.DiscardSomeReadBytes are called to free up memory. The default is 16.
public SetDiscardAfterReads ( int discardAfterReads ) : void
discardAfterReads int
return void

SetSingleDecode() public method

When set to true then only one message is decoded on each IChannelHandler.ChannelRead. Defaults to false for performance reasons.
May be useful if oyu need to do a protocol upgrade and want to make sure nothing is mixed up.
public SetSingleDecode ( bool singleDecode ) : void
singleDecode bool The toggle for single decoding
return void

Property Details

Merge public_oe static_oe property

public static Cumulator Merge
return Cumulator