簡體   English   中英

將大字節數組轉換為 stream C#

[英]Convert large byte array into stream C#

我正在嘗試將字節數組轉換為 stream,但我的數組大於 500kb,因此我的數據 rest 被截斷了。

通過在谷歌上搜索,我找到了參數“maxAllowedSize”,但我不知道在這種情況下如何使用它。

byte[] rawData = { };  // < 500kb
Stream binstream = new MemoryStream(rawData);

您可以使用MemoryStream.SetLength(Int64)來設置 MemoryStream 的最大長度:

byte[] rawData = { };
MemoryStream ms = new MemoryStream();
ms.SetLength(rawData.Length);
ms.Write(rawData, 0, rawData.Length);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM