Class StreamExtensions
Inherited Members
Namespace: PeerTalk
Assembly: PeerTalk.dll
Syntax
public static class StreamExtensions
Methods
| Improve this Doc View SourceReadExactAsync(Stream, Byte[], Int32, Int32)
Asynchronously reads a sequence of bytes from the stream and advances the position within the stream by the number of bytes read.
Declaration
public static Task ReadExactAsync(this Stream stream, byte[] buffer, int offset, int length)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to read from. |
| Byte[] | buffer | The buffer to write the data into. |
| Int32 | offset | The byte offset in |
| Int32 | length | The number of bytes to read. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | When the |
ReadExactAsync(Stream, Byte[], Int32, Int32, CancellationToken)
Asynchronously reads a sequence of bytes from the stream and advances the position within the stream by the number of bytes read.
Declaration
public static Task ReadExactAsync(this Stream stream, byte[] buffer, int offset, int length, CancellationToken cancel)
Parameters
| Type | Name | Description |
|---|---|---|
| Stream | stream | The stream to read from. |
| Byte[] | buffer | The buffer to write the data into. |
| Int32 | offset | The byte offset in |
| Int32 | length | The number of bytes to read. |
| CancellationToken | cancel | Is used to stop the task. |
Returns
| Type | Description |
|---|---|
| Task | A task that represents the asynchronous operation. |
Exceptions
| Type | Condition |
|---|---|
| EndOfStreamException | When the |