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


C# BigEndianBinaryReader.ReadInt16方法代码示例

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


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

示例1: FromStream

        public static Partition FromStream(BigEndianBinaryReader stream)
        {
            var partition = new Partition
            {
                ErrorCode = stream.ReadInt16(),
                PartitionId = stream.ReadInt32(),
                LeaderId = stream.ReadInt32(),
                Replicas = new List<int>(),
                Isrs = new List<int>()
            };

            var numReplicas = stream.ReadInt32();
            for (int i = 0; i < numReplicas; i++)
            {
                partition.Replicas.Add(stream.ReadInt32());
            }

            var numIsr = stream.ReadInt32();
            for (int i = 0; i < numIsr; i++)
            {
                partition.Isrs.Add(stream.ReadInt32());
            }

            return partition;
        }
开发者ID:BDeus,项目名称:KafkaNetClient,代码行数:25,代码来源:Topic.cs

示例2: VerticalMetric

		public VerticalMetric(BigEndianBinaryReader reader)
		{
			Contract.Requires(reader != null);

			AdvanceHeight = reader.ReadUInt16();
			TopSideBearings = reader.ReadInt16();
		}
开发者ID:JeroenBos,项目名称:ASDE,代码行数:7,代码来源:vMetric.cs

示例3: Read

        public object Read(MemoryStream buffer)
        {
            var reader = new BigEndianBinaryReader(buffer);

            var length = reader.ReadInt16();

            byte[] bytes = new byte[length];

            buffer.Read(bytes, 0, length);

            return Encoding.UTF8.GetString(bytes);
        }
开发者ID:rudygt,项目名称:dot-kafka,代码行数:12,代码来源:KafkaString.cs

示例4: Table

		internal Table(BigEndianBinaryReader reader, int fontGlyphCount, int numOfLongVerMetrics)
		{
			Contract.Requires(reader != null);
			Contract.Requires(numOfLongVerMetrics >= 0);
			Contract.Requires(fontGlyphCount >= numOfLongVerMetrics);

			//read vMetric array
			var vMetrics = new VerticalMetric[numOfLongVerMetrics];
			for (int i = 0; i < vMetrics.Length; i++)
			{
				vMetrics[i] = new VerticalMetric(reader);
			}
			VerticalMetrics = new ReadOnlyCollection<VerticalMetric>(vMetrics);

			//read top side bearings array, having length fontGlyphCount - numOfLongVerMetrics, hence VerticalMetrics.Count + TopSideBearings.Count == fontGlyphCount
			var topSideBearings = new short[fontGlyphCount - numOfLongVerMetrics];
			for (int i = 0; i < topSideBearings.Length; i++)
			{
				topSideBearings[i] = reader.ReadInt16();
			}
			TopSideBearings = new ReadOnlyCollection<short>(topSideBearings);
		}
开发者ID:JeroenBos,项目名称:ASDE,代码行数:22,代码来源:Table.cs

示例5: Read

				internal void Read(ushort pc, BigEndianBinaryReader br, ClassFile classFile)
				{
					this.pc = pc;
					ByteCode bc = (ByteCode)br.ReadByte();
					switch(ByteCodeMetaData.GetMode(bc))
					{
						case ByteCodeMode.Simple:
							break;
						case ByteCodeMode.Constant_1:
							arg1 = br.ReadByte();
							classFile.MarkLinkRequiredConstantPoolItem(arg1);
							break;
						case ByteCodeMode.Local_1:
							arg1 = br.ReadByte();
							break;
						case ByteCodeMode.Constant_2:
							arg1 = br.ReadUInt16();
							classFile.MarkLinkRequiredConstantPoolItem(arg1);
							break;
						case ByteCodeMode.Branch_2:
							arg1 = br.ReadInt16();
							break;
						case ByteCodeMode.Branch_4:
							arg1 = br.ReadInt32();
							break;
						case ByteCodeMode.Constant_2_1_1:
							arg1 = br.ReadUInt16();
							classFile.MarkLinkRequiredConstantPoolItem(arg1);
							arg2 = br.ReadByte();
							if(br.ReadByte() != 0)
							{
								throw new ClassFormatError("invokeinterface filler must be zero");
							}
							break;
						case ByteCodeMode.Immediate_1:
							arg1 = br.ReadSByte();
							break;
						case ByteCodeMode.Immediate_2:
							arg1 = br.ReadInt16();
							break;
						case ByteCodeMode.Local_1_Immediate_1:
							arg1 = br.ReadByte();
							arg2 = br.ReadSByte();
							break;
						case ByteCodeMode.Constant_2_Immediate_1:
							arg1 = br.ReadUInt16();
							classFile.MarkLinkRequiredConstantPoolItem(arg1);
							arg2 = br.ReadSByte();
							break;
						case ByteCodeMode.Tableswitch:
						{
							// skip the padding
							uint p = pc + 1u;
							uint align = ((p + 3) & 0x7ffffffc) - p;
							br.Skip(align);
							int default_offset = br.ReadInt32();
							this.arg1 = default_offset;
							int low = br.ReadInt32();
							int high = br.ReadInt32();
							if(low > high || high > 16384L + low)
							{
								throw new ClassFormatError("Incorrect tableswitch");
							}
							SwitchEntry[] entries = new SwitchEntry[high - low + 1];
							for(int i = low; i < high; i++)
							{
								entries[i - low].value = i;
								entries[i - low].target = br.ReadInt32();
							}
							// do the last entry outside the loop, to avoid overflowing "i", if high == int.MaxValue
							entries[high - low].value = high;
							entries[high - low].target = br.ReadInt32();
							this.switch_entries = entries;
							break;
						}
						case ByteCodeMode.Lookupswitch:
						{
							// skip the padding
							uint p = pc + 1u;
							uint align = ((p + 3) & 0x7ffffffc) - p;
							br.Skip(align);
							int default_offset = br.ReadInt32();
							this.arg1 = default_offset;
							int count = br.ReadInt32();
							if(count < 0 || count > 16384)
							{
								throw new ClassFormatError("Incorrect lookupswitch");
							}
							SwitchEntry[] entries = new SwitchEntry[count];
							for(int i = 0; i < count; i++)
							{
								entries[i].value = br.ReadInt32();
								entries[i].target = br.ReadInt32();
							}
							this.switch_entries = entries;
							break;
						}
						case ByteCodeMode.WidePrefix:
							bc = (ByteCode)br.ReadByte();
							// NOTE the PC of a wide instruction is actually the PC of the
//.........这里部分代码省略.........
开发者ID:jira-sarec,项目名称:ICSE-2012-TraceLab,代码行数:101,代码来源:ClassFile.cs

示例6: Read

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


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