本文整理汇总了C#中Mina.Core.Buffer.IoBuffer.GetInt32方法的典型用法代码示例。如果您正苦于以下问题:C# IoBuffer.GetInt32方法的具体用法?C# IoBuffer.GetInt32怎么用?C# IoBuffer.GetInt32使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mina.Core.Buffer.IoBuffer
的用法示例。
在下文中一共展示了IoBuffer.GetInt32方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReadLocator
public static void ReadLocator(IoBuffer buffer, ref Locator obj)
{
if (obj == null)
obj = new Locator();
obj.Kind = (LocatorKind)buffer.GetInt32();
obj.Port = (int)buffer.GetInt32(); ;
byte[] tmp = new byte[16];
buffer.Get(tmp, 0, 16);
obj.SocketAddressBytes = tmp;
}
示例2: 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;
}
}
示例3: 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;
}
示例4: DoDecode
/// <inheritdoc/>
protected override Boolean DoDecode(IoSession session, IoBuffer input, IProtocolDecoderOutput output)
{
if (!input.PrefixedDataAvailable(4, _maxObjectSize))
return false;
input.GetInt32();
output.Write(input.GetObject());
return true;
}
示例5: DecodeBody
protected override Message.AbstractMessage DecodeBody(IoSession session, IoBuffer input)
{
if (input.Remaining < Constants.ADD_BODY_LEN)
{
return null;
}
AddMessage m = new AddMessage();
m.Value = input.GetInt32();
return m;
}
示例6: Decode
public MessageDecoderResult Decode(IoSession session, IoBuffer input, IProtocolDecoderOutput output)
{
int limit = input.Limit;
int position = input.Position;
var len = input.GetInt32();
var version = input.Get();
input.Position = position;
input.Limit = input.Position + len;
var buffer = input.Slice();
input.Position = input.Limit;
input.Limit = limit;
var message = DoDecode(version.ToEnum<MessageVersion>(), buffer);
if (message != null)
output.Write(message);
return MessageDecoderResult.OK;
}
示例7: Decodable
public MessageDecoderResult Decodable(IoSession session, IoBuffer input)
{
if (input.Remaining < MESSAGE_LENGTH_BYTES_LENGTH)
return MessageDecoderResult.NeedData;
var len = input.GetInt32();
if (len > MAX_MESSAGE_LENGTH)
return MessageDecoderResult.NotOK;
if (input.Remaining + MESSAGE_LENGTH_BYTES_LENGTH < len)
return MessageDecoderResult.NeedData;
var version = input.Get().ToEnum<MessageVersion>();
if (version == MessageVersion.BadVersion)
return MessageDecoderResult.NotOK;
if (len < FixedHeaderLength(version))
return MessageDecoderResult.NotOK;
return MessageDecoderResult.OK;
}
示例8: ReadPrimitive
public static void ReadPrimitive(IoBuffer buffer, out int value)
{
value = buffer.GetInt32();
}
示例9: DoDecode
protected override Boolean DoDecode(IoSession session, IoBuffer input, IProtocolDecoderOutput output)
{
Assert.IsTrue(input.HasRemaining);
if (input.Remaining < 4)
return false;
output.Write(input.GetInt32());
return true;
}