Reads exactly count bytes from stream.
public static Task<byte[]> ReadExactlyAsync(this Stream stream, int count,
CancellationToken cancellationToken = default)
parameter | description |
---|---|
stream | The stream to read from. |
count | The count of bytes to read. |
cancellationToken | The cancellation token. |
A new byte array containing the data read from the stream.
Reads exactly count bytes from stream into buffer, starting at the byte given by offset.
public static Task ReadExactlyAsync(this Stream stream, byte[] buffer, int offset, int count,
CancellationToken cancellationToken = default)
parameter | description |
---|---|
stream | The stream to read from. |
buffer | The buffer to read data into. |
offset | The offset within the buffer at which data is first written. |
count | The count of bytes to read. |
cancellationToken | The cancellation token. |