Show / Hide Table of Contents

Class StreamExtensions

Inheritance
Object
StreamExtensions
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: PeerTalk
Assembly: PeerTalk.dll
Syntax
public static class StreamExtensions

Methods

| Improve this Doc View Source

ReadExactAsync(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 buffer at which to begin writing data from the stream.

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 stream does not have length bytes.

| Improve this Doc View Source

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 buffer at which to begin writing data from the stream.

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 stream does not have length bytes.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX