IS [HttpContent.ReadAsByteArrayAsync]的方法保证阅读完整内容? [英] Is [HttpContent.ReadAsByteArrayAsync] method guaranteed to read the full Content?
问题描述
有没有它周围的多文档。
<一href=\"http://msdn.microsoft.com/en-us/library/system.net.http.httpcontent.readasbytearrayasync%28v=vs.118%29.aspx\" rel=\"nofollow\">http://msdn.microsoft.com/en-us/library/system.net.http.httpcontent.readasbytearrayasync(v=vs.118).aspx
There isn't much documentation around it. http://msdn.microsoft.com/en-us/library/system.net.http.httpcontent.readasbytearrayasync(v=vs.118).aspx
如果不保证整个内容我怎么知道什么时候停止阅读?
If it does not guarantee that the whole Content how do I know when to stop reading?
推荐答案
您不告诉它何时停止阅读。它返回一个任务&LT;字节[]&GT;
。这样,经过一定的时间,它要么
You don't tell it when to stop reading. It returns a Task<byte[]>
. So, after some amount of time, it will either
- 读完整个身体,然后把它送给你作为一个单一的
字节[]
或 - 遇到了问题,抛出异常。
如果没有抛出异常,它已经成功地读取整个机身为字节[]
。
If no exception is thrown, it has successfully read the entire body as a byte[]
.
这篇关于IS [HttpContent.ReadAsByteArrayAsync]的方法保证阅读完整内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!