C# Class Helios.Codecs.LengthFieldBasedFrameDecoder

Inheritance: ByteToMessageDecoder
Mostra file Open project: helios-io/helios Class Usage Examples

Public Methods

Method Description
LengthFieldBasedFrameDecoder ( ByteOrder byteOrder, int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip, bool failFast ) : System

Create a new instance.

LengthFieldBasedFrameDecoder ( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength ) : System

Create a new instance.

LengthFieldBasedFrameDecoder ( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip ) : System

Create a new instance.

LengthFieldBasedFrameDecoder ( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip, bool failFast ) : System

Create a new instance.

Protected Methods

Method Description
Decode ( IChannelHandlerContext context, IByteBuf input ) : object

Create a frame out of the IByteBuf and return it.

Decode ( IChannelHandlerContext context, IByteBuf input, List output ) : void
ExtractFrame ( IChannelHandlerContext context, IByteBuf buffer, int index, int length ) : IByteBuf
GetUnadjustedFrameLength ( IByteBuf buffer, int offset, int length, ByteOrder order ) : long

Decodes the specified region of the buffer into an unadjusted frame length. The default implementation is capable of decoding the specified region into an unsigned 8/16/24/32/64 bit integer. Override this method to decode the length field encoded differently. Note that this method must not modify the state of the specified buffer (e.g. IByteBuf.ReaderIndex, IByteBuf.WriterIndex, and the content of the buffer.)

Private Methods

Method Description
Fail ( long frameLength ) : void
FailIfNecessary ( bool firstDetectionOfTooLongFrame ) : void

Method Details

Decode() protected method

Create a frame out of the IByteBuf and return it.
protected Decode ( IChannelHandlerContext context, IByteBuf input ) : object
context IChannelHandlerContext /// The which this belongs /// to. ///
input IByteBuf The from which to read data.
return object

Decode() protected method

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

ExtractFrame() protected method

protected ExtractFrame ( IChannelHandlerContext context, IByteBuf buffer, int index, int length ) : IByteBuf
context IChannelHandlerContext
buffer IByteBuf
index int
length int
return IByteBuf

GetUnadjustedFrameLength() protected method

Decodes the specified region of the buffer into an unadjusted frame length. The default implementation is capable of decoding the specified region into an unsigned 8/16/24/32/64 bit integer. Override this method to decode the length field encoded differently. Note that this method must not modify the state of the specified buffer (e.g. IByteBuf.ReaderIndex, IByteBuf.WriterIndex, and the content of the buffer.)
protected GetUnadjustedFrameLength ( IByteBuf buffer, int offset, int length, ByteOrder order ) : long
buffer IByteBuf The buffer we'll be extracting the frame length from.
offset int The offset from the absolute .
length int The length of the framelenght field. Expected: 1, 2, 3, 4, or 8.
order ByteOrder The preferred of .
return long

LengthFieldBasedFrameDecoder() public method

Create a new instance.
public LengthFieldBasedFrameDecoder ( ByteOrder byteOrder, int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip, bool failFast ) : System
byteOrder ByteOrder The of the lenght field.
maxFrameLength int /// The maximum length of the frame. If the length of the frame is /// greater than this value then will be thrown. ///
lengthFieldOffset int The offset of the length field.
lengthFieldLength int The length of the length field.
lengthAdjustment int The compensation value to add to the value of the length field.
initialBytesToStrip int the number of first bytes to strip out from the decoded frame.
failFast bool /// If true, a is thrown as soon as the decoder notices the length /// of the frame will exceeed regardless of whether the entire frame has been /// read. If false, a is thrown after the entire frame that exceeds /// has been read. /// Defaults to true in other overloads. ///
return System

LengthFieldBasedFrameDecoder() public method

Create a new instance.
public LengthFieldBasedFrameDecoder ( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength ) : System
maxFrameLength int /// The maximum length of the frame. If the length of the frame is /// greater than this value then will be thrown. ///
lengthFieldOffset int The offset of the length field.
lengthFieldLength int The length of the length field.
return System

LengthFieldBasedFrameDecoder() public method

Create a new instance.
public LengthFieldBasedFrameDecoder ( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip ) : System
maxFrameLength int /// The maximum length of the frame. If the length of the frame is /// greater than this value then will be thrown. ///
lengthFieldOffset int The offset of the length field.
lengthFieldLength int The length of the length field.
lengthAdjustment int The compensation value to add to the value of the length field.
initialBytesToStrip int the number of first bytes to strip out from the decoded frame.
return System

LengthFieldBasedFrameDecoder() public method

Create a new instance.
public LengthFieldBasedFrameDecoder ( int maxFrameLength, int lengthFieldOffset, int lengthFieldLength, int lengthAdjustment, int initialBytesToStrip, bool failFast ) : System
maxFrameLength int /// The maximum length of the frame. If the length of the frame is /// greater than this value then will be thrown. ///
lengthFieldOffset int The offset of the length field.
lengthFieldLength int The length of the length field.
lengthAdjustment int The compensation value to add to the value of the length field.
initialBytesToStrip int the number of first bytes to strip out from the decoded frame.
failFast bool /// If true, a is thrown as soon as the decoder notices the length /// of the frame will exceeed regardless of whether the entire frame has been /// read. If false, a is thrown after the entire frame that exceeds /// has been read. /// Defaults to true in other overloads. ///
return System