本文整理汇总了C#中Mina.Core.Buffer.IoBuffer.GetInt16方法的典型用法代码示例。如果您正苦于以下问题:C# IoBuffer.GetInt16方法的具体用法?C# IoBuffer.GetInt16怎么用?C# IoBuffer.GetInt16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mina.Core.Buffer.IoBuffer
的用法示例。
在下文中一共展示了IoBuffer.GetInt16方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DecodeBody
protected override AbstractMessage DecodeBody(IoSession session, IoBuffer input)
{
if (!_readCode)
{
if (input.Remaining < Constants.RESULT_CODE_LEN)
{
return null; // Need more data.
}
_code = input.GetInt16();
_readCode = true;
}
if (_code == Constants.RESULT_OK)
{
if (input.Remaining < Constants.RESULT_VALUE_LEN)
{
return null;
}
ResultMessage m = new ResultMessage();
m.OK = true;
m.Value = input.GetInt32();
_readCode = false;
return m;
}
else
{
ResultMessage m = new ResultMessage();
m.OK = false;
_readCode = false;
return m;
}
}
示例2: Decode
public MessageDecoderResult Decode(IoSession session, IoBuffer input, IProtocolDecoderOutput output)
{
// Try to skip header if not read.
if (!_readHeader)
{
input.GetInt16(); // Skip 'type'.
_sequence = input.GetInt32(); // Get 'sequence'.
_readHeader = true;
}
// Try to decode body
AbstractMessage m = DecodeBody(session, input);
// Return NEED_DATA if the body is not fully read.
if (m == null)
{
return MessageDecoderResult.NeedData;
}
else
{
_readHeader = false; // reset readHeader for the next decode
}
m.Sequence = _sequence;
output.Write(m);
return MessageDecoderResult.OK;
}
示例3: ParameterListEncapsulation
internal ParameterListEncapsulation(IoBuffer bb)
{
#if TODO
this.options = bb.GetInt16();
this.parameters = bb.GetParameterList();
#endif
throw new NotImplementedException();
}
示例4: Decodable
public MessageDecoderResult Decodable(IoSession session, IoBuffer input)
{
// Return NeedData if the whole header is not read yet.
if (input.Remaining < Constants.HEADER_LEN)
return MessageDecoderResult.NeedData;
// Return OK if type and bodyLength matches.
if (_type == input.GetInt16())
return MessageDecoderResult.OK;
// Return NotOK if not matches.
return MessageDecoderResult.NotOK;
}
示例5: ReadPrimitive
public static void ReadPrimitive(IoBuffer buffer, out short value)
{
value = buffer.GetInt16();
}