FileStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) Método

Definição

Inicia uma operação de gravação assíncrona.Begins an asynchronous write operation. Considere o uso de WriteAsync(Byte[], Int32, Int32, CancellationToken) em seu lugar.Consider using WriteAsync(Byte[], Int32, Int32, CancellationToken) instead.

public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ array, int offset, int numBytes, AsyncCallback ^ callback, System::Object ^ state);
public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ buffer, int offset, int count, AsyncCallback ^ callback, System::Object ^ state);
public:
 override IAsyncResult ^ BeginWrite(cli::array <System::Byte> ^ array, int offset, int numBytes, AsyncCallback ^ userCallback, System::Object ^ stateObject);
public override IAsyncResult BeginWrite (byte[] array, int offset, int numBytes, AsyncCallback? callback, object? state);
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count, AsyncCallback callback, object state);
public override IAsyncResult BeginWrite (byte[] array, int offset, int numBytes, AsyncCallback callback, object state);
public override IAsyncResult BeginWrite (byte[] array, int offset, int numBytes, AsyncCallback callback, object? state);
public override IAsyncResult BeginWrite (byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject);
override this.BeginWrite : byte[] * int * int * AsyncCallback * obj -> IAsyncResult
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, numBytes As Integer, callback As AsyncCallback, state As Object) As IAsyncResult
Public Overrides Function BeginWrite (buffer As Byte(), offset As Integer, count As Integer, callback As AsyncCallback, state As Object) As IAsyncResult
Public Overrides Function BeginWrite (array As Byte(), offset As Integer, numBytes As Integer, userCallback As AsyncCallback, stateObject As Object) As IAsyncResult

Parâmetros

arraybuffer
Byte[]

O buffer que contém dados a serem gravados no fluxo atual.The buffer containing data to write to the current stream.

offset
Int32

O deslocamento de bytes baseado em zero em array no qual será iniciada a cópia de bytes no fluxo atual.The zero-based byte offset in array at which to begin copying bytes to the current stream.

numBytescount
Int32

O número máximo de bytes a serem gravados.The maximum number of bytes to write.

callbackuserCallback
AsyncCallback

O método a ser chamado quando a operação de gravação assíncrona for concluída.The method to be called when the asynchronous write operation is completed.

statestateObject
Object

Um objeto fornecido pelo usuário que distingue essa solicitação de gravação assíncrona específica de outras solicitações.A user-provided object that distinguishes this particular asynchronous write request from other requests.

Retornos

IAsyncResult

Um objeto que faz referência à gravação assíncrona.An object that references the asynchronous write.

Exceções

O tamanho de array menos offset é menor que numBytes.array length minus offset is less than numBytes.

array é null.array is null.

offset ou numBytes é negativo.offset or numBytes is negative.

Não há suporte para gravação no fluxo.The stream does not support writing.

O fluxo está fechado.The stream is closed.

Ocorreu um erro de E/S.An I/O error occurred.

Aplica-se a