當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。