Represents extension method for parsing data stored in pipe.
InheritancePipeExtensions
Namespace: DotNext.IO.Pipelines Assembly: DotNext.IO.dll Syntaxpublic static class PipeExtensions
Methods | Edit this page View Source CopyFromAsync(PipeWriter, Stream, long, CancellationToken)
Copies the specified number of bytes from source stream.
Declarationpublic static ValueTask CopyFromAsync(this PipeWriter destination, Stream source, long count, CancellationToken token = default)
Parameters Type Name Description PipeWriter destination
The pipe to write into.
Stream sourceThe source stream.
long countThe number of bytes to be copied.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTaskThe task representing asynchronous execution of this method.
Exceptions | Edit this page View Source CopyToAsync<TConsumer>(PipeReader, TConsumer, long, CancellationToken)Reads the entire content using the specified consumer.
Declarationpublic static ValueTask CopyToAsync<TConsumer>(this PipeReader reader, TConsumer consumer, long count, CancellationToken token = default) where TConsumer : ISupplier<ReadOnlyMemory<byte>, CancellationToken, ValueTask>
Parameters Type Name Description PipeReader reader
The pipe to read from.
TConsumer consumerThe content reader.
long countThe number of bytes to copy.
CancellationToken tokenThe token that can be used to cancel operation.
Returns Type Description ValueTaskThe task representing asynchronous execution of this method.
Type Parameters Name Description TConsumerThe type of the consumer.
Exceptions | Edit this page View Source CopyToAsync<TConsumer>(PipeReader, TConsumer, CancellationToken)Reads the entire content using the specified consumer.
Declarationpublic static ValueTask CopyToAsync<TConsumer>(this PipeReader reader, TConsumer consumer, CancellationToken token = default) where TConsumer : ISupplier<ReadOnlyMemory<byte>, CancellationToken, ValueTask>
Parameters Type Name Description PipeReader reader
The pipe to read from.
TConsumer consumerThe content reader.
CancellationToken tokenThe token that can be used to cancel operation.
Returns Type Description ValueTaskThe task representing asynchronous execution of this method.
Type Parameters Name Description TConsumerThe type of the consumer.
Exceptions | Edit this page View Source DecodeAsync(PipeReader, DecodingContext, LengthFormat, MemoryAllocator<char>?, CancellationToken)Decodes string asynchronously from pipe.
Declarationpublic static ValueTask<MemoryOwner<char>> DecodeAsync(this PipeReader reader, DecodingContext context, LengthFormat lengthFormat, MemoryAllocator<char>? allocator = null, CancellationToken token = default)
Parameters Returns Exceptions | Edit this page View Source DecodeAsync(PipeReader, DecodingContext, LengthFormat, Memory<char>, CancellationToken)
Decodes the sequence of characters.
Declarationpublic static IAsyncEnumerable<ReadOnlyMemory<char>> DecodeAsync(this PipeReader reader, DecodingContext context, LengthFormat lengthFormat, Memory<char> buffer, CancellationToken token = default)
Parameters Type Name Description PipeReader reader
The pipe reader.
DecodingContext contextThe decoding context containing string characters encoding.
LengthFormat lengthFormatThe format of the string length encoded in the stream.
Memory<char> bufferThe buffer of characters.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Exceptions | Edit this page View Source ParseAsync<T>(PipeReader, LengthFormat, NumberStyles, IFormatProvider?, CancellationToken)Parses the numeric value from UTF-8 encoded characters.
Declarationpublic static ValueTask<T> ParseAsync<T>(this PipeReader reader, LengthFormat lengthFormat, NumberStyles style, IFormatProvider? provider = null, CancellationToken token = default) where T : INumberBase<T>
Parameters Type Name Description PipeReader reader
The pipe reader.
LengthFormat lengthFormatThe format of the string length (in bytes) encoded in the stream.
NumberStyles styleA combination of number styles.
IFormatProvider providerCulture-specific formatting information.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTask<T>The result of parsing.
Type Parameters Name Description TThe numeric type.
Exceptions | Edit this page View Source ParseAsync<T>(PipeReader, LengthFormat, IFormatProvider?, CancellationToken)Parses the sequence of characters encoded as UTF-8.
Declarationpublic static ValueTask<T> ParseAsync<T>(this PipeReader reader, LengthFormat lengthFormat, IFormatProvider? provider = null, CancellationToken token = default) where T : IUtf8SpanParsable<T>
Parameters Type Name Description PipeReader reader
The pipe reader.
LengthFormat lengthFormatThe format of the string length (in bytes) encoded in the stream.
IFormatProvider providerCulture-specific formatting information.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTask<T>The result of parsing.
Type Parameters Name Description TThe type that supports parsing from UTF-8.
Exceptions | Edit this page View Source ParseAsync<TArg, TResult>(PipeReader, TArg, ReadOnlySpanFunc<char, TArg, TResult>, DecodingContext, LengthFormat, MemoryAllocator<char>?, CancellationToken)Parses the sequence of characters.
Declarationpublic static ValueTask<TResult> ParseAsync<TArg, TResult>(this PipeReader reader, TArg arg, ReadOnlySpanFunc<char, TArg, TResult> parser, DecodingContext context, LengthFormat lengthFormat, MemoryAllocator<char>? allocator = null, CancellationToken token = default)
Parameters Type Name Description PipeReader reader
The pipe reader.
TArg argThe argument to be passed to parser
.
The parser of characters.
DecodingContext contextThe decoding context containing string characters encoding.
LengthFormat lengthFormatThe format of the string length (in bytes) encoded in the stream.
MemoryAllocator<char> allocatorThe allocator of internal buffer.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTask<TResult>The parsed value.
Type Parameters Name Description TArgThe type of the argument to be passed to parser
.
The type of the result.
Exceptions | Edit this page View Source ReadAllAsync(PipeReader, CancellationToken)Reads all chunks of data from the pipe.
Declarationpublic static IAsyncEnumerable<ReadOnlyMemory<byte>> ReadAllAsync(this PipeReader reader, CancellationToken token = default)
Parameters Returns Exceptions | Edit this page View Source ReadAsync(PipeReader, LengthFormat, MemoryAllocator<byte>?, CancellationToken)
Reads length-prefixed block of bytes.
Declarationpublic static ValueTask<MemoryOwner<byte>> ReadAsync(this PipeReader reader, LengthFormat lengthFormat, MemoryAllocator<byte>? allocator = null, CancellationToken token = default)
Parameters Type Name Description PipeReader reader
The pipe reader.
LengthFormat lengthFormatThe format of the block length encoded in the underlying pipe.
MemoryAllocator<byte> allocatorThe memory allocator used to place the decoded block of bytes.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Exceptions | Edit this page View Source ReadAsync(PipeReader, Memory<byte>, CancellationToken)Reads the block of memory.
Declarationpublic static ValueTask<int> ReadAsync(this PipeReader reader, Memory<byte> output, CancellationToken token = default)
Parameters Type Name Description PipeReader reader
The pipe reader.
Memory<byte> outputThe block of memory to fill from the pipe.
CancellationToken tokenThe token that can be used to cancel operation.
Returns Type Description ValueTask<int>The actual number of copied bytes.
| Edit this page View Source ReadAsync<T>(PipeReader, CancellationToken)Decodes the value of binary formattable type.
Declarationpublic static ValueTask<T> ReadAsync<T>(this PipeReader reader, CancellationToken token = default) where T : IBinaryFormattable<T>
Parameters Returns Type Description ValueTask<T>
The decoded value.
Type Parameters Name Description TThe type of the result.
Exceptions | Edit this page View Source ReadAtLeastAsync(PipeReader, Memory<byte>, int, CancellationToken)Reads at least the specified number of bytes.
Declarationpublic static ValueTask<int> ReadAtLeastAsync(this PipeReader reader, Memory<byte> destination, int minimumSize, CancellationToken token)
Parameters Type Name Description PipeReader reader
The pipe reader.
Memory<byte> destinationThe buffer to write into.
int minimumSizeThe minimum number of bytes to read.
CancellationToken tokenThe token that can be used to cancel operation.
Returns Type Description ValueTask<int>The actual number of bytes written to destination
.
Reads integer encoded in big-endian format.
Declarationpublic static ValueTask<T> ReadBigEndianAsync<T>(this PipeReader reader, CancellationToken token = default) where T : IBinaryInteger<T>
Parameters Returns Type Description ValueTask<T>
The integer value.
Type Parameters Name Description TThe integer type.
Exceptions | Edit this page View Source ReadExactlyAsync(PipeReader, long, CancellationToken)Reads exactly the specified amount of bytes as a sequence of chunks.
Declarationpublic static IAsyncEnumerable<ReadOnlyMemory<byte>> ReadExactlyAsync(this PipeReader reader, long length, CancellationToken token = default)
Parameters Type Name Description PipeReader reader
The pipe reader.
long lengthThe numbers of bytes to read.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Exceptions | Edit this page View Source ReadExactlyAsync(PipeReader, Memory<byte>, CancellationToken)Reads the block of memory.
Declarationpublic static ValueTask ReadExactlyAsync(this PipeReader reader, Memory<byte> output, CancellationToken token = default)
Parameters Type Name Description PipeReader reader
The pipe reader.
Memory<byte> outputThe block of memory to fill from the pipe.
CancellationToken tokenThe token that can be used to cancel operation.
Returns Type Description ValueTaskThe task representing asynchronous state of the operation.
Exceptions | Edit this page View Source ReadLittleEndianAsync<T>(PipeReader, CancellationToken)Reads integer encoded in little-endian format.
Declarationpublic static ValueTask<T> ReadLittleEndianAsync<T>(this PipeReader reader, CancellationToken token = default) where T : IBinaryInteger<T>
Parameters Returns Type Description ValueTask<T>
The integer value.
Type Parameters Name Description TThe integer type.
Exceptions | Edit this page View Source ReadUtf8Async(PipeReader, IBufferWriter<char>, CancellationToken)Decodes null-terminated UTF-8 encoded string.
Declarationpublic static ValueTask ReadUtf8Async(this PipeReader reader, IBufferWriter<char> output, CancellationToken token = default)
Parameters Returns Type Description ValueTask
The task representing asynchronous execution of this method.
Exceptions | Edit this page View Source SkipAsync(PipeReader, long, CancellationToken)Drops the specified number of bytes from the pipe.
Declarationpublic static ValueTask SkipAsync(this PipeReader reader, long length, CancellationToken token = default)
Parameters Type Name Description PipeReader reader
The pipe reader.
long lengthThe number of bytes to skip.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTaskThe task representing asynchronous execution of this method.
Exceptions | Edit this page View Source TryReadExactly(PipeReader, long, out ReadResult)Attempts to read block of data synchronously.
Declarationpublic static bool TryReadExactly(this PipeReader reader, long length, out ReadResult result)
Parameters Type Name Description PipeReader reader
The pipe reader.
long lengthThe length of the block to consume, in bytes.
ReadResult resultThe requested block of data which length is equal to length
in case of success; otherwise, empty block.
true if the block of requested length is obtained successfully; otherwise, false.
| Edit this page View Source WriteAsync(PipeWriter, ReadOnlySequence<byte>, CancellationToken)Writes sequence of bytes to the underlying stream asynchronously.
Declarationpublic static ValueTask WriteAsync(this PipeWriter writer, ReadOnlySequence<byte> sequence, CancellationToken token = default)
Parameters Returns Type Description ValueTask
The task representing asynchronous execution of this method.
ExceptionsRetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4