Providers a uniform way to decode the data from various sources such as streams, pipes, unmanaged memory etc.
Namespace: DotNext.IO Assembly: DotNext.IO.dll Syntaxpublic interface IAsyncBinaryReader
Properties | Edit this page View Source Empty
Represents empty reader.
Declarationpublic static IAsyncBinaryReader Empty { get; }
Property Value Methods | Edit this page View Source CopyToAsync(IBufferWriter<byte>, long?, CancellationToken)
Copies the content to the specified buffer.
DeclarationValueTask CopyToAsync(IBufferWriter<byte> destination, long? count = null, CancellationToken token = default)
Parameters Returns Type Description ValueTask
The task representing asynchronous result.
Exceptions | Edit this page View Source CopyToAsync(PipeWriter, long?, CancellationToken)Copies the content to the specified pipe writer.
DeclarationValueTask CopyToAsync(PipeWriter destination, long? count = null, CancellationToken token = default)
Parameters Type Name Description PipeWriter destination
The writer.
long? countThe number of bytes to copy.
CancellationToken tokenThe token that can be used to cancel operation.
Returns Type Description ValueTaskThe task representing asynchronous result.
Exceptions | Edit this page View Source CopyToAsync(Stream, long?, CancellationToken)Copies the content to the specified stream.
DeclarationValueTask CopyToAsync(Stream destination, long? count = null, CancellationToken token = default)
Parameters Type Name Description Stream destination
The output stream receiving object content.
long? countThe number of bytes to copy.
CancellationToken tokenThe token that can be used to cancel asynchronous operation.
Returns Type Description ValueTaskThe task representing asynchronous result.
Exceptions | Edit this page View Source CopyToAsync<TConsumer>(TConsumer, long?, CancellationToken)Reads the entire content using the specified delegate.
DeclarationValueTask CopyToAsync<TConsumer>(TConsumer consumer, long? count = null, CancellationToken token = default) where TConsumer : ISupplier<ReadOnlyMemory<byte>, CancellationToken, ValueTask>
Parameters Type Name Description TConsumer consumer
The content reader.
long? countThe number of bytes to copy.
CancellationToken tokenThe token that can be used to cancel the 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 Create(ReadOnlySequence<byte>)Creates default implementation of binary reader over sequence of bytes.
Declarationpublic static SequenceReader Create(ReadOnlySequence<byte> sequence)
Parameters Returns Type Description SequenceReader
The binary reader for the sequence of bytes.
| Edit this page View Source Create(PipeReader)Creates default implementation of binary reader for the specifed pipe reader.
Declarationpublic static IAsyncBinaryReader Create(PipeReader reader)
Parameters Type Name Description PipeReader reader
The pipe reader.
Returns Exceptions | Edit this page View Source Create(Stream, Memory<byte>)Creates default implementation of binary reader for the stream.
Declarationpublic static IAsyncBinaryReader Create(Stream input, Memory<byte> buffer)
Parameters Type Name Description Stream input
The stream to be wrapped into the reader.
Memory<byte> bufferThe buffer used for decoding data from the stream.
Returns Exceptions | Edit this page View Source Create(ReadOnlyMemory<byte>)Creates default implementation of binary reader over contiguous memory block.
Declarationpublic static SequenceReader Create(ReadOnlyMemory<byte> memory)
Parameters Returns Type Description SequenceReader
The binary reader for the memory block.
| Edit this page View Source DecodeAsync(DecodingContext, LengthFormat, MemoryAllocator<char>?, CancellationToken)Decodes the sequence of characters.
DeclarationValueTask<MemoryOwner<char>> DecodeAsync(DecodingContext context, LengthFormat lengthFormat, MemoryAllocator<char>? allocator = null, CancellationToken token = default)
Parameters Type Name Description DecodingContext context
The decoding context containing string characters encoding.
LengthFormat lengthFormatThe format of the string length encoded in the stream.
MemoryAllocator<char> allocatorThe allocator of the buffer of characters.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Exceptions | Edit this page View Source DecodeAsync(DecodingContext, LengthFormat, Memory<char>, CancellationToken)Decodes the sequence of characters.
DeclarationIAsyncEnumerable<ReadOnlyMemory<char>> DecodeAsync(DecodingContext context, LengthFormat lengthFormat, Memory<char> buffer, CancellationToken token = default)
Parameters Type Name Description DecodingContext context
The 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>(LengthFormat, NumberStyles, IFormatProvider?, CancellationToken)Parses the numeric value from UTF-8 encoded characters.
DeclarationValueTask<T> ParseAsync<T>(LengthFormat lengthFormat, NumberStyles style, IFormatProvider? provider = null, CancellationToken token = default) where T : INumberBase<T>
Parameters Type Name Description LengthFormat lengthFormat
The 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>(LengthFormat, IFormatProvider?, CancellationToken)Parses the sequence of characters encoded as UTF-8.
DeclarationValueTask<T> ParseAsync<T>(LengthFormat lengthFormat, IFormatProvider? provider = null, CancellationToken token = default) where T : IUtf8SpanParsable<T>
Parameters Type Name Description LengthFormat lengthFormat
The 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<T>(DecodingContext, LengthFormat, NumberStyles, IFormatProvider?, MemoryAllocator<char>?, CancellationToken)Parses the numeric value.
DeclarationValueTask<T> ParseAsync<T>(DecodingContext context, LengthFormat lengthFormat, NumberStyles style, IFormatProvider? provider = null, MemoryAllocator<char>? allocator = null, CancellationToken token = default) where T : INumberBase<T>
Parameters Type Name Description DecodingContext context
The decoding context containing string characters encoding.
LengthFormat lengthFormatThe format of the string length (in bytes) encoded in the stream.
NumberStyles styleA combination of number styles.
IFormatProvider providerCulture-specific formatting information.
MemoryAllocator<char> allocatorThe allocator of internal buffer.
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<TArg, TResult>(TArg, ReadOnlySpanFunc<char, TArg, TResult>, DecodingContext, LengthFormat, MemoryAllocator<char>?, CancellationToken)Parses the sequence of characters.
DeclarationValueTask<TResult> ParseAsync<TArg, TResult>(TArg arg, ReadOnlySpanFunc<char, TArg, TResult> parser, DecodingContext context, LengthFormat lengthFormat, MemoryAllocator<char>? allocator = null, CancellationToken token = default)
Parameters Type Name Description TArg arg
The 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 ReadAsync(LengthFormat, MemoryAllocator<byte>?, CancellationToken)Reads the memory block.
DeclarationValueTask<MemoryOwner<byte>> ReadAsync(LengthFormat lengthFormat, MemoryAllocator<byte>? allocator = null, CancellationToken token = default)
Parameters Type Name Description LengthFormat lengthFormat
The format of the string length encoded in the stream.
MemoryAllocator<byte> allocatorAn allocator of the resulting buffer.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Exceptions | Edit this page View Source ReadAsync(Memory<byte>, CancellationToken)Reads the block of bytes.
DeclarationValueTask ReadAsync(Memory<byte> destination, CancellationToken token = default)
Parameters Type Name Description Memory<byte> destination
The block of memory to fill.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTaskThe task representing state of asynchronous execution.
Exceptions | Edit this page View Source ReadAsync<T>(CancellationToken)Decodes the value of binary formattable type.
DeclarationValueTask<T> ReadAsync<T>(CancellationToken token = default) where T : IBinaryFormattable<T>
Parameters Type Name Description CancellationToken token
The token that can be used to cancel the operation.
Returns Type Description ValueTask<T>The decoded value.
Type Parameters Name Description TThe type of the result.
Exceptions | Edit this page View Source ReadAsync<TReader>(TReader, CancellationToken)Consumes memory block.
DeclarationValueTask<TReader> ReadAsync<TReader>(TReader reader, CancellationToken token = default) where TReader : struct, IBufferReader
Parameters Type Name Description TReader reader
The reader of the memory block.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTask<TReader>The copy of reader
.
The type of the consumer.
Exceptions | Edit this page View Source ReadBigEndianAsync<T>(CancellationToken)Reads integer encoded in big-endian format.
DeclarationValueTask<T> ReadBigEndianAsync<T>(CancellationToken token = default) where T : IBinaryInteger<T>
Parameters Type Name Description CancellationToken token
The token that can be used to cancel the operation.
Returns Type Description ValueTask<T>The integer value.
Type Parameters Name Description TThe integer type.
Exceptions | Edit this page View Source ReadLittleEndianAsync<T>(CancellationToken)Reads integer encoded in little-endian format.
DeclarationValueTask<T> ReadLittleEndianAsync<T>(CancellationToken token = default) where T : IBinaryInteger<T>
Parameters Type Name Description CancellationToken token
The token that can be used to cancel the operation.
Returns Type Description ValueTask<T>The integer value.
Type Parameters Name Description TThe integer type.
Exceptions | Edit this page View Source SkipAsync(long, CancellationToken)Skips the block of bytes.
DeclarationValueTask SkipAsync(long length, CancellationToken token = default)
Parameters Type Name Description long length
The length of the block to skip, in bytes.
CancellationToken tokenThe token that can be used to cancel the operation.
Returns Type Description ValueTaskThe task representing state of asynchronous execution.
Exceptions | Edit this page View Source TryGetRemainingBytesCount(out long)Attempts to get the number of bytes available for read.
Declarationbool TryGetRemainingBytesCount(out long count)
Parameters Type Name Description long count
The number of bytes available for read.
Returns Type Description booltrue if the method is supported; otherwise, false.
| Edit this page View Source TryGetSequence(out ReadOnlySequence<byte>)Attempts to get the entire content represented by this reader.
Declarationbool TryGetSequence(out ReadOnlySequence<byte> bytes)
Parameters Returns Type Description bool
true if the content is available synchronously; otherwise, false.
Extension Methods See AlsoRetroSearch 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