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


C# BigEndianBinaryReader.ReadInt64方法代码示例

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


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

示例1: ConstantPoolItemLong

			internal ConstantPoolItemLong(BigEndianBinaryReader br)
			{
				l = br.ReadInt64();
			}
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:4,代码来源:ClassFile.cs

示例2: Read

 public object Read(MemoryStream buffer)
 {
     var reader = new BigEndianBinaryReader(buffer);
     return reader.ReadInt64();
 }
开发者ID:rudygt,项目名称:dot-kafka,代码行数:5,代码来源:KafkaInt64.cs

示例3: DecodeMessageSet

        /// <summary>
        /// Decode a byte[] that represents a collection of messages.
        /// </summary>
        /// <param name="messageSet">The byte[] encode as a message set from kafka.</param>
        /// <returns>Enumerable representing stream of messages decoded from byte[]</returns>
        public static IEnumerable<Message> DecodeMessageSet(byte[] messageSet)
        {
            using (var stream = new BigEndianBinaryReader(messageSet))
            {
                while (stream.HasData)
                {
                    //this checks that we have at least the minimum amount of data to retrieve a header
                    if (stream.Available(MessageHeaderSize) == false)
                        yield break;

                    var offset = stream.ReadInt64();
                    var messageSize = stream.ReadInt32();

                    //if messagessize is greater than the total payload, our max buffer is insufficient.
                    if ((stream.Length - MessageHeaderSize) < messageSize)
                        throw new BufferUnderRunException(MessageHeaderSize, messageSize);

                    //if the stream does not have enough left in the payload, we got only a partial message
                    if (stream.Available(messageSize) == false)
                        yield break;

                    foreach (var message in DecodeMessage(offset, stream.RawRead(messageSize)))
                    {
                        yield return message;
                    }
                }
            }
        }
开发者ID:jsifantu,项目名称:kafka-net,代码行数:33,代码来源:Message.cs

示例4: ReadConstantPool


//.........这里部分代码省略.........
                         u2 string_index;
                     }
                 */
                 item.ConstantType = ConstantType.String;
                 item.StringIndex = reader.ReadUInt16();
                 break;
             case ConstantType.Integer:
                 /*
                     CONSTANT_Integer_info {
                         u1 tag;
                         u4 bytes;
                     }
                 */
                 item.ConstantType = ConstantType.Integer;
                 item.Integer = reader.ReadInt32();
                 break;
             case ConstantType.Float:
                 /*
                     CONSTANT_Float_info {
                         u1 tag;
                         u4 bytes;
                     }
                 */
                 item.ConstantType = ConstantType.Float;
                 item.Float = reader.ReadSingle();
                 break;
             case ConstantType.Long:
                 /*
                     CONSTANT_Long_info {
                         u1 tag;
                         u4 high_bytes;
                         u4 low_bytes;
                     }
                 */
                 item.ConstantType = ConstantType.Long;
                 item.Long = reader.ReadInt64();
                 // JVM Spec. 4.4.5.
                 // All 8-byte constants take up two entries in the
                 // constant_pool table of the class file. If a
                 // CONSTANT_Long_info or CONSTANT_Double_info structure
                 // is the item in the constant_pool table at index n,
                 // then the next usable item in the pool is located at
                 // index n+2. The constant_pool index n+1 must be valid
                 // but is considered unusable.2
                 // 2 In retrospect, making 8-byte constants take two
                 // constant pool entries was a poor choice.
                 ++i;
                 break;
             case ConstantType.Double:
                 /*
                     CONSTANT_Double_info {
                         u1 tag;
                         u4 high_bytes;
                         u4 low_bytes;
                     }
                 */
                 item.ConstantType = ConstantType.Double;
                 item.Double = reader.ReadDouble();
                 // JVM Spec. 4.4.5.
                 // All 8-byte constants take up two entries in the
                 // constant_pool table of the class file. If a
                 // CONSTANT_Long_info or CONSTANT_Double_info structure
                 // is the item in the constant_pool table at index n,
                 // then the next usable item in the pool is located at
                 // index n+2. The constant_pool index n+1 must be valid
                 // but is considered unusable.2
                 // 2 In retrospect, making 8-byte constants take two
                 // constant pool entries was a poor choice.
                 ++i;
                 break;
             case ConstantType.NameAndType:
                 /*
                     CONSTANT_NameAndType_info {
                         u1 tag;
                         u2 name_index;
                         u2 descriptor_index;
                     }
                 */
                 item.ConstantType = ConstantType.NameAndType;
                 item.NameIndex = reader.ReadUInt16();
                 item.DescriptorIndex = reader.ReadUInt16();
                 break;
             case ConstantType.Utf8:
                 /*
                     CONSTANT_Utf8_info {
                         u1 tag;
                         u2 length;
                         u1 bytes[length];
                     }
                 */
                 item.ConstantType = ConstantType.Utf8;
                 item.String = reader.ReadString(reader.ReadUInt16());
                 break;
             default:
                 throw new ApplicationException("Wrong ConstantType: " +
                     tag);
         }
     }
     return constantPool;
 }
开发者ID:olympum,项目名称:caffeine,代码行数:101,代码来源:ClassFile.cs


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