更新时间:2023-11-13 09:14:58
将文件读入内存流非常容易,只需查看以下示例,您应该能够将其转换为适合您的需求:
to read a file into a memorystream is quite easy, just have a look at the following example and you should be able to convert it to suite your needs:
Dim bData As Byte()
Dim br As BinaryReader = New BinaryReader(System.IO.File.OpenRead(Path))
bData = br.ReadBytes(br.BaseStream.Length)
Dim ms As MemoryStream = New MemoryStream(bData, 0, bData.Length)
ms.Write(bData, 0, bData.Length)
然后随意使用 MemoryStream ms.只是为了清除 Path
包含您想要读入内存流的完整路径和文件名.
then just use the MemoryStream ms as you please. Just to clearify Path
holds the full path and filename you want to read into your memorystream.