Class PipeReaderExtensions
- Namespace
- IceRpc.Slice.Operations
- Assembly
- IceRpc.Slice.dll
Provides extension methods for PipeReader.
public static class PipeReaderExtensions
- Inheritance
-
PipeReaderExtensions
- Inherited Members
Methods
ToAsyncStream<T>(PipeReader, DecodeFunc<T>, ISliceProxy?, ISliceFeature?)
Creates an async stream over a pipe reader to decode variable size streamed elements.
public static IAsyncStream<T> ToAsyncStream<T>(this PipeReader reader, DecodeFunc<T> decodeFunc, ISliceProxy? sender = null, ISliceFeature? sliceFeature = null)
Parameters
readerPipeReaderThe pipe reader.
decodeFuncDecodeFunc<T>The function used to decode the streamed member.
senderISliceProxyThe proxy that sent the request, if applicable.
sliceFeatureISliceFeatureThe slice feature to customize the decoding.
Returns
- IAsyncStream<T>
The async stream to decode and return the streamed members.
Type Parameters
TThe stream element type.
Remarks
The reader ownership is transferred to the returned async stream. The caller should no longer use the reader after this call, and must dispose the returned async stream when done to release the reader.
ToAsyncStream<T>(PipeReader, DecodeFunc<T>, int, ISliceFeature?)
Creates an async stream over a pipe reader to decode streamed elements.
public static IAsyncStream<T> ToAsyncStream<T>(this PipeReader reader, DecodeFunc<T> decodeFunc, int elementSize, ISliceFeature? sliceFeature = null)
Parameters
readerPipeReaderThe pipe reader.
decodeFuncDecodeFunc<T>The function used to decode the streamed member.
elementSizeintThe size in bytes of one element.
sliceFeatureISliceFeatureThe Slice feature to customize the decoding.
Returns
- IAsyncStream<T>
The async stream to decode and return the streamed elements.
Type Parameters
TThe type of the element being decoded.
Remarks
The reader ownership is transferred to the returned async stream. The caller should no longer use the reader after this call, and must dispose the returned async stream when done to release the reader.
Exceptions
- ArgumentException
Thrown if
elementSizeis equal of inferior to0.