本文整理汇总了C#中System.IO.FileStream.ReadInt方法的典型用法代码示例。如果您正苦于以下问题:C# FileStream.ReadInt方法的具体用法?C# FileStream.ReadInt怎么用?C# FileStream.ReadInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileStream
的用法示例。
在下文中一共展示了FileStream.ReadInt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: readMetadataTable
private static Metadata readMetadataTable(FileStream metadataStream, int offset)
{
MetadataTableInfo info = readMetadataTableInfo(metadataStream, offset);
List<Tuple<int, byte[]>> table = new List<Tuple<int, byte[]>>();
int offs_acc = info.tableOffset.value;
for(int i=0; i<info.numEntries; i++)
{
table.Add(readMetadataEntry(metadataStream, offs_acc));
offs_acc += metadataStream.ReadInt(offs_acc) + 4;
offs_acc = HexTools.align(offs_acc); //word align
}
Metadata ret = new Metadata();
ret.data = table;
ret.info = info;
return ret;
}
示例2: readMetadataTableInfo
private static MetadataTableInfo readMetadataTableInfo(FileStream metadataStream, int offset)
{
MetadataTableInfo info = new MetadataTableInfo();
info.identifier = metadataStream.ReadASCII(offset, IDENTIFIER_LENGTH);
info.tableOffset = new Pointer(metadataStream.ReadData(offset + IDENTIFIER_LENGTH, 4));
info.numEntries = metadataStream.ReadInt(offset + 4 + IDENTIFIER_LENGTH);
info.totalLength = metadataStream.ReadInt(offset + 8 + IDENTIFIER_LENGTH);
return info;
}
示例3: getDereferenceOf
/*public byte[] getAt(int offset, int length)
{
//Returns [offset, offset+length)
}
public byte[] getDereferenceOf(int offset, int length)
{
//Returns [*offset, *offset+length)
}*/
private static Tuple<int, byte[]> readMetadataEntry(FileStream metadataStream, int offset)
{
//Returns [*(offset+4), *(offset+4)+*offset)
return Tuple.Create(metadataStream.ReadInt(offset),
metadataStream.ReadData(offset + 4, metadataStream.ReadInt(offset)));
}