GZipStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) 方法

定义

开始异步写操作。 (请考虑改用 WriteAsync(Byte[], Int32, Int32) 方法。)

public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ array, int offset, int count, AsyncCallback ^ asyncCallback, System::Object ^ asyncState);
public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ buffer, int offset, int count, AsyncCallback ^ asyncCallback, System::Object ^ asyncState);
public override IAsyncResult BeginWrite (byte[] array, int offset, int count, AsyncCallback? asyncCallback, object? asyncState);
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback? asyncCallback, object? asyncState);
public override IAsyncResult BeginWrite (byte[] array, int offset, int count, AsyncCallback asyncCallback, object asyncState);
override this.BeginWrite : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
override this.BeginWrite : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
Public Overrides Function BeginWrite (array As Byte(), offset As Integer, count As Integer, asyncCallback As AsyncCallback, asyncState As Object) As IAsyncResult
Public Overrides Function BeginWrite (buffer As Byte(), offset As Integer, count As Integer, asyncCallback As AsyncCallback, asyncState As Object) As IAsyncResult

参数

arraybuffer
Byte[]

包含要写入当前流的数据的缓冲区。

offset
Int32

开始写入的字节偏移量。

count
Int32

最多写入的字节数。

asyncCallback
AsyncCallback

可选的异步回调,在完成写入操作时调用。

asyncState
Object

一个用户提供的对象,它将该特定的异步写入请求与其他请求区别开来。

返回

表示异步写入操作(可能仍处于挂起状态)的对象。

例外

此基础流为 null

- 或 -

基础流已关闭。

注解

从 .NET Framework 4.5 开始,可以使用 方法执行异步写入操作Stream.WriteAsync。 方法 BeginWrite 在当前版本中仍可用,以支持旧代码;但是,通过使用新的异步方法,可以更轻松地实现异步 I/O 操作。 有关详细信息,请参阅异步文件 I/O

方法 BeginWrite 启动对 GZipStream 流对象的异步写入操作。

必须创建实现委托的回调方法, AsyncCallback 并将其名称传递给 BeginWrite 方法。

适用于