Chained StreamWrite Async(Byte, Int 32, Int 32, Cancellation Token) Method
Asynchronously write a sequence of bytes to the stream and advances the current
position within this stream by the number of bytes written.
Definition
Namespace: MimeKit.IO
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
A task that represents the asynchronous write operation.
Assembly: MimeKit.Core (in MimeKit.Core.dll) Version: 5.0.0
C#
public override Task WriteAsync(
byte[] buffer,
int offset,
int count,
CancellationToken cancellationToken
)Parameters
- buffer Byte
- The buffer to write.
- offset Int32
- The offset of the first byte to write.
- count Int32
- The number of bytes to write.
- cancellationToken CancellationToken
- The cancellation token.
Return Value
TaskA task that represents the asynchronous write operation.
Remarks
Writes the requested number of bytes if writing is supported. If the
current child stream does not have enough remaining space to fit the
complete buffer, the data will spill over into the next stream in the
chain in order to complete the write.
Exceptions
| ArgumentNullException | buffer is . |
| ArgumentOutOfRangeException |
offset is less than zero or greater than the length of buffer. -or- The buffer is not large enough to contain count bytes starting at the specified offset. |
| ObjectDisposedException | The stream has been disposed. |
| NotSupportedException | The stream does not support writing. |
| IOException | An I/O error occurred. |