我有一个类,我用它来向我的数据库发送文件数据和从我的数据库发送文件数据,我的问题是。如何在不先将数据保存到 memoryStream 的情况下将文件数据直接写入类中的属性。这样做会有优势吗?
Class Rif
Public Property fileData As Stream
End Class
Dim rif = New Rif
Dim buf As Byte() = New Byte(1023) {}
Using stream As Stream = myResp.GetResponseStream()
rif.fileData = stream.Read(buf, 0, 1024)
Dim count As Integer
Do
count = stream.Read(buf, 0, 1024)
rif.fileData.Write(buf, 0, count)
Loop While stream.CanRead AndAlso count > 0