MemoryStream: WriteBlock |
Writes an array of bytes to the underlying stream.
Public Sub WriteBlock( ByRef Buffer ( ) As Byte, ByVal Offset As Long, ByVal Count As Long )
The Offset parameter gives the offset of the first byte in Buffer to write from, and the Count parameter gives the number of bytes to write. If the write operation is successful, the current position within the stream is advanced by the number of bytes written. If an exception occurs, the current position within the stream is unchanged.
Except for a MemoryStream constructed with a Byte() parameter, write operations at the end of a MemoryStream expand the MemoryStream.
Exception | Condition |
---|---|
ArgumentNullException | Buffer is uninitialized. |
NotSupportedException |
The stream does not support writing. For additional information see CanWriter. -or- The current position is closer than Count bytes to the end of the stream, and the capacity cannot be modified. |
ArgumentException | Offset subtracted from the Buffer length is less than Count. |
ArgumentOutOfRangeException | Offset or Count is negative. |
ObjectDisposedException | The current stream instance is closed. |