本文整理匯總了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;
}
示例2: VerticalMetric
public VerticalMetric(BigEndianBinaryReader reader)
{
Contract.Requires(reader != null);
AdvanceHeight = reader.ReadUInt16();
TopSideBearings = reader.ReadInt16();
}
示例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);
}
示例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);
}
示例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
//.........這裏部分代碼省略.........
示例6: Read
public object Read(MemoryStream buffer)
{
var reader = new BigEndianBinaryReader(buffer);
return reader.ReadInt16();
}