本文整理汇总了C#中System.IO.FileStream.ReadData方法的典型用法代码示例。如果您正苦于以下问题:C# FileStream.ReadData方法的具体用法?C# FileStream.ReadData怎么用?C# FileStream.ReadData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.IO.FileStream
的用法示例。
在下文中一共展示了FileStream.ReadData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetInstallationStream
public Stream GetInstallationStream(string moduleName, string installationFile)
{
var installationFilePath = GetInstallationFilePath(moduleName, installationFile);
if (File.Exists(installationFilePath))
{
using (var fs = new FileStream(installationFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
return new MemoryStream(fs.ReadData());
}
}
return null;
}
示例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)));
}