【发布时间】:2012-02-21 20:26:27
【问题描述】:
好的,我有图像,我在其中绑定了信息,我想阅读信息
现在从文件 (FileStream) 开始工作
但我不想从文件中做,所以我需要使用 MemoryStream
这里是有效的示例以及我现在如何使用 MemoryStream(使用 byte = My.Resources 或 PictureBox1.image)
Using FS As New IO.FileStream(image, IO.FileMode.Open)
FS.Seek(0, IO.SeekOrigin.End)
While Not FS.ReadByte = Asc("|")
FS.Position -= 2
End While
Dim s As String = Nothing
While Not FS.Position = FS.Length - 4
s &= Chr(FS.ReadByte.ToString)
End While
Dim Ext As String = Nothing
FS.Seek(0, IO.SeekOrigin.End)
While Not FS.ReadByte = Asc("*")
FS.Position -= 2
End While
While Not FS.Position = FS.Length
Ext &= Chr(FS.ReadByte.ToString)
End While
FS.Seek(FS.Length - ((s.Length + s) + 5), IO.SeekOrigin.Begin)
While Not FS.Position = FS.Length - (s.Length + 5)
Dim Data As Byte() = New Byte(FS.Position) {}
FS.Read(Data, 0, Data.Length)
FS.Close()
End While
最后保存字节到文件
我尝试这样使用它
使用 FS 作为新的 IO.MemoryStream(image) 'image = byte()
但不工作
如何才能在内存中再次读取它
谢谢
【问题讨论】:
标签: vb.net memorystream