ComponentStreamWriter Class
The writable end of a stream held by the host: the host writes values that a component reads.
public sealed class ComponentStreamWriter : IDisposable- Implements
Properties
| Name | Description |
|---|---|
| IsReaderDropped | Gets whether the reader dropped its end: no more values can be written. |
| ReaderDroppedToken | Gets a token that is cancelled when the reader drops its end, such as to stop an operation of the host that produces the values (the reception of a socket). The token is cancelled on the thread of the store. |
IsReaderDropped
ComponentStreams.csReaderDroppedToken
ComponentStreams.csGets a token that is cancelled when the reader drops its end, such as to stop an operation of the host that produces the values (the reception of a socket). The token is cancelled on the thread of the store.
public CancellationToken ReaderDroppedToken { get; }Property value
Methods
| Name | Description |
|---|---|
| Create(ComponentValueType?, ComponentValue) | Creates a stream: the host writes to the writer, and gives the readable end to a component. |
| Dispose() | Drops the writable end: the reader reads the end of the stream. |
| WriteAsync(ComponentValue[], CancellationToken) | Writes values: returns the number of values the reader read, which is less than the count when the reader dropped its end. |
| WriteAsync(ReadOnlyMemory<byte>, CancellationToken) | Writes bytes to a stream<u8>: returns the number of bytes the reader read. |
Create(ComponentValueType?, ComponentValue)
ComponentStreams.csCreates a stream: the host writes to the writer, and gives the readable end to a component.
public static ComponentStreamWriter Create(ComponentValueType? elementType, out ComponentValue readable)Parameters
elementTypeComponentValueType?- The type of the elements, or null.
readableComponentValue- The readable end, to give to a component as a value of type
stream.
Returns
Dispose()
ComponentStreams.csDrops the writable end: the reader reads the end of the stream.
public void Dispose()WriteAsync overloads
WriteAsync(ComponentValue[], CancellationToken)
ComponentStreams.csWrites values: returns the number of values the reader read, which is less than the count when the reader dropped its end.
net10.0
public ValueTask<int> WriteAsync(ComponentValue[] values, CancellationToken cancellationToken = default)net11.0
public ValueTask<int> WriteAsync(ComponentValue[] values, CancellationToken cancellationToken = default)WriteAsync(ReadOnlyMemory<byte>, CancellationToken)
ComponentStreams.csWrites bytes to a stream<u8>: returns the number of bytes the reader read.
public ValueTask<int> WriteAsync(ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken = default)