Skip to content

Interface IManualStream

Namespace: Void.Proxy.Api.Network.Streams.Manual
Assembly: Void.Proxy.Api.dll

Defines direct byte-oriented read and write operations for a proxy stream.

public interface IManualStream

Methods

Read(Span<byte>)

Reads up to the length of a destination span.

int Read(Span<byte> span)

Parameters

span Span<byte>

The destination for bytes read from the stream.

Returns

int

The number of bytes read, which can be less than the span length.

ReadAsync(Memory<byte>, CancellationToken)

Asynchronously reads up to the length of a destination memory region.

ValueTask<int> ReadAsync(Memory<byte> memory, CancellationToken cancellationToken = default)

Parameters

memory Memory<byte>

The destination for bytes read from the stream.

cancellationToken CancellationToken

A token used to cancel the read.

Returns

ValueTask<int>

The number of bytes read, which can be less than the memory length.

ReadExactly(Span<byte>)

Reads until a destination span is completely filled.

void ReadExactly(Span<byte> span)

Parameters

span Span<byte>

The destination that must be filled.

ReadExactlyAsync(Memory<byte>, CancellationToken)

Asynchronously reads until a destination memory region is completely filled.

ValueTask ReadExactlyAsync(Memory<byte> memory, CancellationToken cancellationToken = default)

Parameters

memory Memory<byte>

The destination that must be filled.

cancellationToken CancellationToken

A token used to cancel the read.

Returns

ValueTask

A task that completes when the destination is full.

Write(ReadOnlySpan<byte>)

Writes all bytes from a source span.

void Write(ReadOnlySpan<byte> span)

Parameters

span ReadOnlySpan<byte>

The bytes to write.

WriteAsync(ReadOnlyMemory<byte>, CancellationToken)

Asynchronously writes all bytes from a source memory region.

ValueTask WriteAsync(ReadOnlyMemory<byte> memory, CancellationToken cancellationToken = default)

Parameters

memory ReadOnlyMemory<byte>

The bytes to write.

cancellationToken CancellationToken

A token used to cancel the write.

Returns

ValueTask

A task that completes when the bytes have been written.