Show / Hide Table of Contents

Interface IAsyncBinaryReader

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
Syntax
public interface IAsyncBinaryReader

Properties

| Improve this Doc View Source

Empty

Represents empty reader.

Declaration
static IAsyncBinaryReader Empty { get; }
Property Value
Type Description
IAsyncBinaryReader

Methods

| Improve this Doc View Source

CopyToAsync(IBufferWriter<Byte>, CancellationToken)

Copies the content to the specified buffer.

Declaration
virtual Task CopyToAsync(IBufferWriter<byte> writer, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
IBufferWriter<Byte> writer

The buffer writer.

CancellationToken token

The token that can be used to cancel operation.

Returns
Type Description
Task

The task representing asynchronous execution of this method.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

CopyToAsync(PipeWriter, CancellationToken)

Copies the content to the specified pipe writer.

Declaration
Task CopyToAsync(PipeWriter output, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
PipeWriter output

The writer.

CancellationToken token

The token that can be used to cancel operation.

Returns
Type Description
Task

The task representing asynchronous execution of this method.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

CopyToAsync(Stream, CancellationToken)

Copies the content to the specified stream.

Declaration
Task CopyToAsync(Stream output, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Stream output

The output stream receiving object content.

CancellationToken token

The token that can be used to cancel asynchronous operation.

Returns
Type Description
Task
Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

CopyToAsync<TArg>(ReadOnlySpanAction<Byte, TArg>, TArg, CancellationToken)

Reads the entire content using the specified delegate.

Declaration
virtual Task CopyToAsync<TArg>(ReadOnlySpanAction<byte, TArg> consumer, TArg arg, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
ReadOnlySpanAction<Byte, TArg> consumer

The content reader.

TArg arg

The argument to be passed to the content reader.

CancellationToken token

The token that can be used to cancel operation.

Returns
Type Description
Task

The task representing asynchronous execution of this method.

Type Parameters
Name Description
TArg

The type of the argument to be passed to the content reader.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

CopyToAsync<TArg>(Func<ReadOnlyMemory<Byte>, TArg, CancellationToken, ValueTask>, TArg, CancellationToken)

Reads the entire content using the specified delegate.

Declaration
virtual Task CopyToAsync<TArg>(Func<ReadOnlyMemory<byte>, TArg, CancellationToken, ValueTask> consumer, TArg arg, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Func<ReadOnlyMemory<Byte>, TArg, CancellationToken, ValueTask> consumer

The content reader.

TArg arg

The argument to be passed to the content reader.

CancellationToken token

The token that can be used to cancel operation.

Returns
Type Description
Task

The task representing asynchronous execution of this method.

Type Parameters
Name Description
TArg

The type of the argument to be passed to the content reader.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

| Improve this Doc View Source

Create(ReadOnlySequence<Byte>)

Creates default implementation of binary reader over sequence of bytes.

Declaration
static SequenceBinaryReader Create(ReadOnlySequence<byte> sequence)
Parameters
Type Name Description
ReadOnlySequence<Byte> sequence

The sequence of bytes.

Returns
Type Description
SequenceBinaryReader

The binary reader for the sequence of bytes.

| Improve this Doc View Source

Create(PipeReader)

Creates default implementation of binary reader for the specifed pipe reader.

Declaration
static IAsyncBinaryReader Create(PipeReader reader)
Parameters
Type Name Description
PipeReader reader

The pipe reader.

Returns
Type Description
IAsyncBinaryReader

The binary reader.

Remarks

It is recommended to use extension methods from PipeExtensions class for decoding data from the stream. This method is intended for situation when you need an object implementing IAsyncBinaryReader interface.

Exceptions
Type Condition
ArgumentNullException

reader is null.

| Improve this Doc View Source

Create(Stream, Memory<Byte>)

Creates default implementation of binary reader for the stream.

Declaration
static IAsyncBinaryReader Create(Stream input, Memory<byte> buffer)
Parameters
Type Name Description
Stream input

The stream to be wrapped into the reader.

Memory<Byte> buffer

The buffer used for decoding data from the stream.

Returns
Type Description
IAsyncBinaryReader

The stream reader.

Remarks

It is recommended to use extension methods from StreamExtensions class for decoding data from the stream. This method is intended for situation when you need an object implementing IAsyncBinaryReader interface.

Exceptions
Type Condition
ArgumentNullException

input is null.

ArgumentException

buffer is empty.

| Improve this Doc View Source

Create(ReadOnlyMemory<Byte>)

Creates default implementation of binary reader over contiguous memory block.

Declaration
static SequenceBinaryReader Create(ReadOnlyMemory<byte> memory)
Parameters
Type Name Description
ReadOnlyMemory<Byte> memory

The block of memory.

Returns
Type Description
SequenceBinaryReader

The binary reader for the memory block.

| Improve this Doc View Source

ReadAsync(Memory<Byte>, CancellationToken)

Reads the block of bytes.

Declaration
ValueTask ReadAsync(Memory<byte> output, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Memory<Byte> output

The block of memory to fill.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask

The task representing state of asynchronous execution.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadAsync<T>(CancellationToken)

Decodes the value of blittable type.

Declaration
ValueTask<T> ReadAsync<T>(CancellationToken token = default(CancellationToken))

    where T : struct
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
T

The type of the result.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadByteAsync(StringLengthEncoding, DecodingContext, NumberStyles, IFormatProvider, CancellationToken)

Parses 8-bit unsigned integer from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<byte> ReadByteAsync(StringLengthEncoding lengthFormat, DecodingContext context, NumberStyles style = NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.Integer, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

NumberStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Byte>

The parsed value.

Exceptions
Type Condition
FormatException

The number is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadDateTimeAsync(StringLengthEncoding, DecodingContext, DateTimeStyles, IFormatProvider, CancellationToken)

Parses DateTime from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<DateTime> ReadDateTimeAsync(StringLengthEncoding lengthFormat, DecodingContext context, DateTimeStyles style = DateTimeStyles.None, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

DateTimeStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<DateTime>

The parsed value.

Exceptions
Type Condition
FormatException

The date/time is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadDateTimeAsync(StringLengthEncoding, DecodingContext, String[], DateTimeStyles, IFormatProvider, CancellationToken)

Parses DateTime from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<DateTime> ReadDateTimeAsync(StringLengthEncoding lengthFormat, DecodingContext context, string[] formats, DateTimeStyles style = DateTimeStyles.None, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

String[] formats

An array of allowable formats.

DateTimeStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<DateTime>

The parsed value.

Exceptions
Type Condition
FormatException

The date/time is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadDateTimeOffsetAsync(StringLengthEncoding, DecodingContext, DateTimeStyles, IFormatProvider, CancellationToken)

Parses DateTimeOffset from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<DateTimeOffset> ReadDateTimeOffsetAsync(StringLengthEncoding lengthFormat, DecodingContext context, DateTimeStyles style = DateTimeStyles.None, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

DateTimeStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<DateTimeOffset>

The parsed value.

Exceptions
Type Condition
FormatException

The date/time is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadDateTimeOffsetAsync(StringLengthEncoding, DecodingContext, String[], DateTimeStyles, IFormatProvider, CancellationToken)

Parses DateTimeOffset from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<DateTimeOffset> ReadDateTimeOffsetAsync(StringLengthEncoding lengthFormat, DecodingContext context, string[] formats, DateTimeStyles style = DateTimeStyles.None, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

String[] formats

An array of allowable formats.

DateTimeStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<DateTimeOffset>

The parsed value.

Exceptions
Type Condition
FormatException

The date/time is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadDecimalAsync(StringLengthEncoding, DecodingContext, NumberStyles, IFormatProvider, CancellationToken)

Parses Decimal from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<decimal> ReadDecimalAsync(StringLengthEncoding lengthFormat, DecodingContext context, NumberStyles style = NumberStyles.AllowDecimalPoint | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowThousands | NumberStyles.AllowTrailingSign | NumberStyles.AllowTrailingWhite | NumberStyles.Integer | NumberStyles.Number, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

NumberStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Decimal>

The parsed value.

Exceptions
Type Condition
FormatException

The number is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadDoubleAsync(StringLengthEncoding, DecodingContext, NumberStyles, IFormatProvider, CancellationToken)

Parses double-precision floating-point number from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<double> ReadDoubleAsync(StringLengthEncoding lengthFormat, DecodingContext context, NumberStyles style = NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowThousands | NumberStyles.AllowTrailingWhite | NumberStyles.Float | NumberStyles.Integer, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

NumberStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Double>

The parsed value.

Exceptions
Type Condition
FormatException

The number is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadGuidAsync(StringLengthEncoding, DecodingContext, String, CancellationToken)

Parses Guid from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<Guid> ReadGuidAsync(StringLengthEncoding lengthFormat, DecodingContext context, string format, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

String format

The expected format of GUID value.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Guid>

The parsed value.

Exceptions
Type Condition
FormatException

GUID is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadGuidAsync(StringLengthEncoding, DecodingContext, CancellationToken)

Parses Guid from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<Guid> ReadGuidAsync(StringLengthEncoding lengthFormat, DecodingContext context, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Guid>

The parsed value.

Exceptions
Type Condition
FormatException

GUID is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadInt16Async(StringLengthEncoding, DecodingContext, NumberStyles, IFormatProvider, CancellationToken)

Parses 16-bit signed integer from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<short> ReadInt16Async(StringLengthEncoding lengthFormat, DecodingContext context, NumberStyles style = NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.Integer, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

NumberStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int16>

The parsed value.

Exceptions
Type Condition
FormatException

The number is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadInt16Async(Boolean, CancellationToken)

Decodes 16-bit signed integer using the specified endianness.

Declaration
virtual ValueTask<short> ReadInt16Async(bool littleEndian, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Boolean littleEndian

true if value is stored in the underlying binary stream as little-endian; otherwise, use big-endian.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int16>

The decoded value.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadInt32Async(StringLengthEncoding, DecodingContext, NumberStyles, IFormatProvider, CancellationToken)

Parses 32-bit signed integer from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<int> ReadInt32Async(StringLengthEncoding lengthFormat, DecodingContext context, NumberStyles style = NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.Integer, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

NumberStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int32>

The parsed value.

Exceptions
Type Condition
FormatException

The number is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadInt32Async(Boolean, CancellationToken)

Decodes 32-bit signed integer using the specified endianness.

Declaration
virtual ValueTask<int> ReadInt32Async(bool littleEndian, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Boolean littleEndian

true if value is stored in the underlying binary stream as little-endian; otherwise, use big-endian.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int32>

The decoded value.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadInt64Async(StringLengthEncoding, DecodingContext, NumberStyles, IFormatProvider, CancellationToken)

Parses 64-bit signed integer from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<long> ReadInt64Async(StringLengthEncoding lengthFormat, DecodingContext context, NumberStyles style = NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite | NumberStyles.Integer, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

NumberStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int64>

The parsed value.

Exceptions
Type Condition
FormatException

The number is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadInt64Async(Boolean, CancellationToken)

Decodes 64-bit signed integer using the specified endianness.

Declaration
virtual ValueTask<long> ReadInt64Async(bool littleEndian, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Boolean littleEndian

true if value is stored in the underlying binary stream as little-endian; otherwise, use big-endian.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Int64>

The decoded value.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadSingleAsync(StringLengthEncoding, DecodingContext, NumberStyles, IFormatProvider, CancellationToken)

Parses single-precision floating-point number from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<float> ReadSingleAsync(StringLengthEncoding lengthFormat, DecodingContext context, NumberStyles style = NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent | NumberStyles.AllowLeadingSign | NumberStyles.AllowLeadingWhite | NumberStyles.AllowThousands | NumberStyles.AllowTrailingWhite | NumberStyles.Float | NumberStyles.Integer, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

NumberStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<Single>

The parsed value.

Exceptions
Type Condition
FormatException

The number is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadStringAsync(StringLengthEncoding, DecodingContext, CancellationToken)

Decodes the string.

Declaration
ValueTask<string> ReadStringAsync(StringLengthEncoding lengthFormat, DecodingContext context, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<String>

The decoded string.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

ArgumentOutOfRangeException

lengthFormat is invalid.

| Improve this Doc View Source

ReadStringAsync(Int32, DecodingContext, CancellationToken)

Decodes the string.

Declaration
ValueTask<string> ReadStringAsync(int length, DecodingContext context, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
Int32 length

The length of the encoded string, in bytes.

DecodingContext context

The decoding context containing string characters encoding.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<String>

The decoded string.

Exceptions
Type Condition
OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadTimeSpanAsync(StringLengthEncoding, DecodingContext, IFormatProvider, CancellationToken)

Parses TimeSpan from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<TimeSpan> ReadTimeSpanAsync(StringLengthEncoding lengthFormat, DecodingContext context, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TimeSpan>

The parsed value.

Exceptions
Type Condition
FormatException

The time span is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

| Improve this Doc View Source

ReadTimeSpanAsync(StringLengthEncoding, DecodingContext, String[], TimeSpanStyles, IFormatProvider, CancellationToken)

Parses TimeSpan from its string representation encoded in the underlying stream.

Declaration
virtual ValueTask<TimeSpan> ReadTimeSpanAsync(StringLengthEncoding lengthFormat, DecodingContext context, string[] formats, TimeSpanStyles style = TimeSpanStyles.None, IFormatProvider provider = null, CancellationToken token = default(CancellationToken))
Parameters
Type Name Description
StringLengthEncoding lengthFormat

The format of the string length encoded in the stream.

DecodingContext context

The decoding context containing string characters encoding.

String[] formats

An array of allowable formats.

TimeSpanStyles style

A bitwise combination of the enumeration values that indicates the style elements.

IFormatProvider provider

An object that supplies culture-specific formatting information.

CancellationToken token

The token that can be used to cancel the operation.

Returns
Type Description
ValueTask<TimeSpan>

The parsed value.

Exceptions
Type Condition
FormatException

The time span is in incorrect format.

OperationCanceledException

The operation has been canceled.

EndOfStreamException

The underlying source doesn't contain necessary amount of bytes to decode the value.

Extension Methods

AsyncLockAcquisition.AcquireLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireReadLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireWriteLockAsync<T>(T, CancellationToken)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, TimeSpan)
AsyncLockAcquisition.AcquireUpgradeableReadLockAsync<T>(T, CancellationToken)
ObjectExtensions.GetUserData<T>(T)
ObjectExtensions.IsOneOf<T>(T, IEnumerable<T>)
ObjectExtensions.IsOneOf<T>(T, T[])
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>, out TResult1, out TResult2)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, Func<T, TResult1>, Func<T, TResult2>)
ObjectExtensions.Decompose<T, TResult1, TResult2>(T, ValueFunc<T, TResult1>, ValueFunc<T, TResult2>)
ObjectExtensions.As<T>(T)
LockAcquisition.AcquireReadLock<T>(T)
LockAcquisition.AcquireReadLock<T>(T, TimeSpan)
LockAcquisition.AcquireWriteLock<T>(T)
LockAcquisition.AcquireWriteLock<T>(T, TimeSpan)
LockAcquisition.AcquireUpgradeableReadLock<T>(T)
LockAcquisition.AcquireUpgradeableReadLock<T>(T, TimeSpan)
ExpressionBuilder.Const<T>(T)

See Also

IAsyncBinaryWriter
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX