当前位置: 首页>>代码示例>>C#>>正文


C# IoBuffer.GetInt32方法代码示例

本文整理汇总了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;
        }
开发者ID:Egipto87,项目名称:DOOP.ec,代码行数:11,代码来源:LocatorEncoder.cs

示例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;
            }
        }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:34,代码来源:ResultMessageDecoder.cs

示例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;
        }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:26,代码来源:AbstractMessageDecoder.cs

示例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;
        }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:10,代码来源:ObjectSerializationDecoder.cs

示例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;
        }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:11,代码来源:AddMessageDecoder.cs

示例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;
 }
开发者ID:zesus19,项目名称:c5.v1,代码行数:16,代码来源:AbstractMessageDecoder.cs

示例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;
        }
开发者ID:zesus19,项目名称:c5.v1,代码行数:17,代码来源:AbstractMessageDecoder.cs

示例8: ReadPrimitive

 public static void ReadPrimitive(IoBuffer buffer, out int value)
 {
     value = buffer.GetInt32();
 }
开发者ID:Egipto87,项目名称:DOOP.ec,代码行数:4,代码来源:Primitives.cs

示例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;
            }
开发者ID:zhangf911,项目名称:Mina.NET,代码行数:10,代码来源:CumulativeProtocolDecoderTest.cs


注:本文中的Mina.Core.Buffer.IoBuffer.GetInt32方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。