BufferedStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object) 메서드

정의

비동기 쓰기 작업을 시작합니다. 대신 WriteAsync(Byte[], Int32, Int32, CancellationToken)를 사용하세요.

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

매개 변수

buffer
Byte[]

현재 스트림에 쓸 데이터를 포함하는 버퍼입니다.

offset
Int32

현재 스트림으로 바이트를 복사하기 시작할 buffer의 바이트 오프셋(0부터 시작)입니다.

count
Int32

쓸 최대 바이트 수입니다.

callback
AsyncCallback

비동기 쓰기 작업이 완료되면 호출될 메서드입니다.

state
Object

다른 요청에서 특정 비동기 쓰기 요청을 구별하는 사용자 제공 개체입니다.

반환

IAsyncResult

보류 중인 비동기 쓰기를 참조하는 개체입니다.

예외

buffer 길이에서 offset을 뺀 값이 count보다 작습니다.

buffer이(가) null인 경우

offset 또는 count가 음수입니다.

스트림이 쓰기를 지원하지 않습니다.

설명

.NET Framework 4 및 이전 버전에서는 비동기 파일 작업과 EndWrite 같은 BeginWrite 메서드를 사용하고 구현해야 합니다. 이러한 메서드는 레거시 코드를 지원하기 위해 .NET Framework 4.5에서 계속 사용할 수 있지만, 새로운 비동기 메서드(예: ReadAsync, WriteAsyncFlushAsync)는 비동기 파일 작업을 보다 쉽게 구현하는 데 도움이 됩니다.

EndWrite는 모든 에서 BeginWrite정확히 한 번 IAsyncResult 호출되어야 합니다. EndWrite 는 I/O 작업이 완료될 때까지 차단됩니다.

적용 대상