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


C# ByteBuffer.GetByte方法代码示例

本文整理汇总了C#中Apache.Qpid.Buffer.ByteBuffer.GetByte方法的典型用法代码示例。如果您正苦于以下问题:C# ByteBuffer.GetByte方法的具体用法?C# ByteBuffer.GetByte怎么用?C# ByteBuffer.GetByte使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Apache.Qpid.Buffer.ByteBuffer的用法示例。


在下文中一共展示了ByteBuffer.GetByte方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PopulateMethodBodyFromBuffer

 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Table = EncodingUtils.ReadFieldTable(buffer);
     IntegerOp = buffer.GetByte();
     StringOp = buffer.GetByte();
     		 
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:TestTableBody.cs

示例2: PopulateMethodBodyFromBuffer

 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     Integer1 = buffer.GetByte();
     Integer2 = buffer.GetUInt16();
     Integer3 = buffer.GetUInt32();
     Integer4 = buffer.GetUInt64();
     Operation = buffer.GetByte();
     		 
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:9,代码来源:TestIntegerBody.cs

示例3: PopulateMethodBodyFromBuffer

 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     VersionMajor = buffer.GetByte();
     VersionMinor = buffer.GetByte();
     ServerProperties = EncodingUtils.ReadFieldTable(buffer);
     Mechanisms = EncodingUtils.ReadLongstr(buffer);
     Locales = EncodingUtils.ReadLongstr(buffer);
     		 
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:9,代码来源:ConnectionStartBody.cs

示例4: PopulateMethodBodyFromBuffer

 protected override void PopulateMethodBodyFromBuffer(ByteBuffer buffer)
 {
     String1 = EncodingUtils.ReadShortString(buffer);
     String2 = EncodingUtils.ReadLongstr(buffer);
     Operation = buffer.GetByte();
     		 
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:7,代码来源:TestStringBody.cs

示例5: Decodable

        public MessageDecoderResult Decodable(ByteBuffer input)
        {
            if (_disabled)
            {
                return MessageDecoderResult.NOT_OK;
            }
            // final +1 represents the command end which we know we must require even
            // if there is an empty body
            if (input.Remaining < 1)
            {
                return MessageDecoderResult.NEED_DATA;
            }
            byte type = input.GetByte();

            // we have to check this isn't a protocol initiation frame here - we can't tell later on and we end up
            // waiting for more data. This could be improved if MINA supported some kind of state awareness when decoding
            if ((char)type == 'A')
            {
                _logger.Error("Received what appears to be a protocol initiation frame");
                return MessageDecoderResult.NOT_OK;
            }
            // zero, channel, body size and end byte
            if (input.Remaining < (1 + 2 + 4 + 1))
            {
                return MessageDecoderResult.NEED_DATA;
            }

            int channel = input.GetUInt16();
            long bodySize = input.GetUInt32();            

            // bodySize can be zero
            if (type <= 0 || channel < 0 || bodySize < 0)
            {
                _logger.Error(String.Format("Error decoding frame: Type={0}, Channel={1}, BodySize={2}", type, channel, bodySize));                
                return MessageDecoderResult.NOT_OK;
            }

            if (input.Remaining < (bodySize + 1))
            {
                return MessageDecoderResult.NEED_DATA;
            }

            if (IsSupportedFrameType(type))
            {
                if (_logger.IsDebugEnabled)
                {
                    // we have read 7 bytes so far, so output 7 + bodysize + 1 (for end byte) to get complete data block size
                    // this logging statement is useful when looking at exactly what size of data is coming in/out
                    // the broker
                    _logger.Debug("Able to decode data block of size " + (bodySize + 8));
                }
                return MessageDecoderResult.OK;
            }
            else
            {
                return MessageDecoderResult.NOT_OK;
            }
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:58,代码来源:AMQDataBlockDecoder.cs

示例6: ReadByte

 public static byte ReadByte(ByteBuffer buffer)
 {
    return buffer.GetByte();
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:4,代码来源:EncodingUtils.cs

示例7: ReadChar

 public static char ReadChar(ByteBuffer buffer)
 {
    return (char)buffer.GetByte();
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:4,代码来源:EncodingUtils.cs

示例8: ReadBoolean

 public static bool ReadBoolean(ByteBuffer buffer)
 {
    byte packedValue = buffer.GetByte();
    return (packedValue == 1);
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:5,代码来源:EncodingUtils.cs

示例9: ReadShortString

      /// <summary>
      /// Read a short string from the buffer
      /// </summary>
      /// <param name="buffer">The buffer to read from.</param>
      /// <returns>a string</returns>
      /// <exception cref="AMQFrameDecodingException">if the buffer does not contain a decodable short string</exception>
      public static string ReadShortString(ByteBuffer buffer)
      {
         byte length = buffer.GetByte();
         if ( length == 0 )
         {
            return null;
         } else
         {
            byte[] data = new byte[length];
            buffer.GetBytes(data);

            lock ( DEFAULT_ENCODER )
            {
               return DEFAULT_ENCODER.GetString(data);
            }
         }
      }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:23,代码来源:EncodingUtils.cs

示例10: ReadBooleans

      // BOOLEANS
      public static bool[] ReadBooleans(ByteBuffer buffer)
      {
         byte packedValue = buffer.GetByte();
         bool[] result = new bool[8];

         for ( int i = 0; i < 8; i++ )
         {
            result[i] = ((packedValue & (1 << i)) != 0);
         }
         return result;
      }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:12,代码来源:EncodingUtils.cs

示例11: Decodable

 public MessageDecoderResult Decodable(ByteBuffer inbuf)
 {
     if (_disabled)
     {
         return MessageDecoderResult.NOT_OK;
     }
     if (inbuf.Remaining < 8)
     {
         return MessageDecoderResult.NEED_DATA;
     }
     else
     {
         char[] expected = new char[]{'A', 'M', 'Q', 'P'};
         for (int i = 0; i < 4; i++)
         {
             if (((char) inbuf.GetByte()) != expected[i])
             {
                 return MessageDecoderResult.NOT_OK;
             }
         }
         return MessageDecoderResult.OK;
     }
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:23,代码来源:ProtocolInitiation.cs

示例12: Decode

 /// <summary>
 /// Decodes the specified session.
 /// </summary>
 /// <param name="inbuf">The inbuf.</param>
 /// <param name="output">The protocol output.</param>
 /// <returns></returns>
 public MessageDecoderResult Decode(ByteBuffer inbuf, IProtocolDecoderOutput output)
 {
     byte[] header = new byte[4];
     inbuf.GetBytes(header);
     ProtocolInitiation pi = new ProtocolInitiation();
     pi.Header = new char[]{'A','M','Q','P'};
     pi.ProtocolClass = inbuf.GetByte();
     pi.ProtocolInstance = inbuf.GetByte();
     pi.ProtocolMajor = inbuf.GetByte();
     pi.ProtocolMinor = inbuf.GetByte();
     output.Write(pi);
     return MessageDecoderResult.OK;
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:19,代码来源:ProtocolInitiation.cs

示例13: CreateAndPopulateFrame

        protected Object CreateAndPopulateFrame(ByteBuffer input)
        {
            byte type = input.GetByte();
            ushort channel = input.GetUInt16();
            uint bodySize = input.GetUInt32();

            IBodyFactory bodyFactory = (IBodyFactory)_supportedBodies[type];
            if (bodyFactory == null)
            {
                throw new AMQFrameDecodingException("Unsupported body type: " + type);
            }
            AMQFrame frame = new AMQFrame();

            frame.PopulateFromBuffer(input, channel, bodySize, bodyFactory);

            byte marker = input.GetByte();
            if (marker != 0xCE) {
           		throw new FormatException("marker is not 0xCE"); 	
            }
            return frame;
        }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:21,代码来源:AMQDataBlockDecoder.cs

示例14: PopulatePropertiesFromBuffer

 public void PopulatePropertiesFromBuffer(ByteBuffer buffer, ushort propertyFlags)
 {
    _log.Debug("Property flags: " + propertyFlags);
    if ( (propertyFlags & (1 << 15)) > 0 )
       ContentType = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 14)) > 0 )
       Encoding = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 13)) > 0 )
       Headers = EncodingUtils.ReadFieldTable(buffer);
    if ( (propertyFlags & (1 << 12)) > 0 )
       DeliveryMode = buffer.GetByte();
    if ( (propertyFlags & (1 << 11)) > 0 )
       Priority = buffer.GetByte();
    if ( (propertyFlags & (1 << 10)) > 0 )
       CorrelationId = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 9)) > 0 )
       ReplyTo = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 8)) > 0 )
       Expiration = EncodingUtils.ReadLongAsShortString(buffer);
    if ( (propertyFlags & (1 << 7)) > 0 )
       MessageId = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 6)) > 0 )
       Timestamp = buffer.GetUInt64();
    if ( (propertyFlags & (1 << 5)) > 0 )
       Type = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 4)) > 0 )
       UserId = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 3)) > 0 )
       AppId = EncodingUtils.ReadShortString(buffer);
    if ( (propertyFlags & (1 << 2)) > 0 )
       ClusterId = EncodingUtils.ReadShortString(buffer);
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:32,代码来源:BasicContentHeaderProperties.cs

示例15: ReadFromBuffer

 public static AMQTypedValue ReadFromBuffer(ByteBuffer buffer)
 {
    AMQType type = AMQTypeMap.GetType(buffer.GetByte());
    return new AMQTypedValue(type, buffer);
 }
开发者ID:drzo,项目名称:opensim4opencog,代码行数:5,代码来源:AMQTypedValue.cs


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