MemoryStream: BeginWrite

BeginWrite

Begins an asynchronous buffer write. For a MemoryStream, having an asynchronous buffer write is of no use.



 Public Function BeginWrite(
	  ByRef Buffer ( ) As Byte,
	  ByVal Offset As Long,
	  ByVal Count As Long,
	  Optional ByVal Callback As AsyncCallback,
	  Optional ByRef State As Variant ) As IAsyncResult

Parameters

Buffer
[ByRef] Byte. The source array to copy the bytes from into the stream.
Offset
[ByVal] Long. The starting index in the source Buffer to begin copying from.
Count
[ByVal] Long. The maximum number of bytes to be copied into the stream.
Callback
[ByVal] Optional. AsyncCallback. A user supplied object to be notified of the finish of the writing.
State
[ByRef] Optional. Variant. User data that can be carried within the IAsyncResult object return.

Return Values

IAsyncResult -  An IAsyncResult object used to identify the corrisponding EndBread and report information about the buffer read.

Remarks

Since the stream is directly stored and accessed in memory, there is no waiting for reads to occur. The BeginWrite method works identical to the WriteBlock method in terms of reading immediately writing stream data to the stream.

When defining the Count for the number of maximum bytes to be written, if the Buffer does not have enough bytes, an exception will be thrown in the EndWrite method.

If an exception has occurred during the read, it will not be thrown until the EndRead is executed.

See Also

Project CorLib Overview

Class MemoryStream Overview