DeflateStream.EndRead(IAsyncResult) 方法


等待挂起的异步读取完成。Waits for the pending asynchronous read to complete. (请考虑改用 ReadAsync(Byte[], Int32, Int32) 方法。)(Consider using the ReadAsync(Byte[], Int32, Int32) method instead.)

 override int EndRead(IAsyncResult ^ asyncResult);
 override int EndRead(IAsyncResult ^ async_result);
public override int EndRead (IAsyncResult asyncResult);
public override int EndRead (IAsyncResult async_result);
override this.EndRead : IAsyncResult -> int
override this.EndRead : IAsyncResult -> int
Public Overrides Function EndRead (asyncResult As IAsyncResult) As Integer
Public Overrides Function EndRead (async_result As IAsyncResult) As Integer



对要完成的挂起异步请求的引用。The reference to the pending asynchronous request to finish.


从流中读取的字节数,介于 0(零)和你请求的字节数之间。The number of bytes read from the stream, between 0 (zero) and the number of bytes you requested. DeflateStream 仅在流的末尾返回零 (0);否则将一直阻塞,只到至少有一个字节可用。DeflateStream returns 0 only at the end of the stream; otherwise, it blocks until at least one byte is available.


asyncResultnullasyncResult is null.

asyncResult 不源于当前流的 BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) 方法。asyncResult did not originate from a BeginRead(Byte[], Int32, Int32, AsyncCallback, Object) method on the current stream.

在调用 WaitOne() 期间引发了异常。An exception was thrown during a call to WaitOne().

结束调用无效,原因是该流的异步读取操作尚未完成。The end call is invalid because asynchronous read operations for this stream are not yet complete.


此流为 nullThe stream is null.


.NET Framework 4.5.NET Framework 4.5开始,你可以通过使用 ReadAsync 方法执行异步读取操作。Starting with the .NET Framework 4.5.NET Framework 4.5, you can perform asynchronous read operations by using the ReadAsync method. EndRead 方法仍在 .NET Framework 4.5.NET Framework 4.5 中可用以支持旧版代码;不过,您可以使用新的异步方法更轻松地实现异步 i/o 操作。The EndRead method is still available in the .NET Framework 4.5.NET Framework 4.5 to support legacy code; however, you can implement asynchronous I/O operations more easily by using the new async methods. 有关详细信息,请参阅异步文件 I/OFor more information, see Asynchronous File I/O.

调用此方法以确定从流中读取的字节数。Call this method to determine how many bytes were read from the stream. 可以调用此方法一次,以返回对 BeginReadEndRead的调用之间的读取字节量。This method can be called once to return the amount of bytes read between calls to BeginRead and EndRead.

此方法将一直阻塞,直到 I/O 操作已完成。This method blocks until the I/O operation has completed.