本文整理匯總了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();
}