![](/img/trans.png)
[英]How to Convert from MemoryStream to FileStream to pass to MS Graph?
[英]How convert MemoryStream to FileStream?
工作:
using (ZipInputStream s = new ZipInputStream(File.OpenRead(zipFile)))
{
ZipEntry theEntry;
while ((theEntry = s.GetNextEntry()) != null)
{
}
}
不工作,記憶流
using (ZipInputStream s = new ZipInputStream(memorystream))
{
ZipEntry theEntry;
while ((theEntry = s.GetNextEntry()) != null)//Exception **EOF in header**
{
}
}
如何轉換?
在不了解您正在使用的ZipInputStream
,我唯一可以冒險的猜測是它正在嘗試使用您正在將該流的位置重置為開頭之前傳遞的MemoryStream
。 嘗試在代碼段之前添加此行:
memoryStream.Seek(0, SeekOrigin.Begin);
FileStream fs = new Filestream();
調用new Filestream();
是不正確的。 FileStream
沒有任何帶零參數的構造函數。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.