Represents binary reader for the sequence of bytes.
Namespace: DotNext.IO Assembly: DotNext.IO.dll Syntaxpublic struct SequenceReader : IAsyncBinaryReader, IResettable
Constructors | Edit this page View Source SequenceReader(ReadOnlySequence<byte>)
Represents binary reader for the sequence of bytes.
Declarationpublic SequenceReader(ReadOnlySequence<byte> sequence)
Parameters See Also Properties | Edit this page View Source IsEmpty
Indicates that the current reader has no more data to read.
Declarationpublic readonly bool IsEmpty { get; }
Property Value | Edit this page View Source Position
Gets position in the underlying sequence.
Declarationpublic readonly SequencePosition Position { get; }
Property Value | Edit this page View Source RemainingSequence
Gets unread part of the sequence.
Declarationpublic readonly ReadOnlySequence<byte> RemainingSequence { get; }
Property Value Methods | Edit this page View Source Decode(in DecodingContext, LengthFormat, MemoryAllocator<char>?)
Decodes a block of characters.
Declarationpublic MemoryOwner<char> Decode(in DecodingContext context, LengthFormat lengthFormat, MemoryAllocator<char>? allocator = null)
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.
Returns Exceptions Type Condition EndOfStreamExceptionThe underlying source doesn't contain necessary amount of bytes to decode the value.
| Edit this page View Source Decode(in DecodingContext, LengthFormat, Memory<char>)Decodes the sequence of characters.
Declarationpublic SequenceReader.DecodingEnumerable Decode(in DecodingContext context, LengthFormat lengthFormat, Memory<char> buffer)
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.
Returns Exceptions | Edit this page View Source Decode(in DecodingContext, LengthFormat, Span<char>)Decodes the sequence of characters.
Declarationpublic SequenceReader.SpanDecodingEnumerable Decode(in DecodingContext context, LengthFormat lengthFormat, Span<char> buffer)
Parameters Type Name Description DecodingContext context
The decoding context containing string characters encoding.
LengthFormat lengthFormatThe format of the string length encoded in the stream.
Span<char> bufferThe buffer of characters.
Returns Exceptions | Edit this page View Source Parse<T>(LengthFormat, NumberStyles, IFormatProvider?)Parses the numeric value from UTF-8 encoded characters.
Declarationpublic T Parse<T>(LengthFormat lengthFormat, NumberStyles style, IFormatProvider? provider = null) 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.
Returns Type Description TThe result of parsing.
Type Parameters Name Description TThe numeric type.
Exceptions | Edit this page View Source Parse<T>(LengthFormat, IFormatProvider?)Parses the sequence of characters encoded as UTF-8.
Declarationpublic T Parse<T>(LengthFormat lengthFormat, IFormatProvider? provider = null) 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.
Returns Type Description TThe result of parsing.
Type Parameters Name Description TThe type that supports parsing from UTF-8.
Exceptions | Edit this page View Source Parse<T>(in DecodingContext, LengthFormat, NumberStyles, IFormatProvider?, MemoryAllocator<char>?)Parses the numeric value.
Declarationpublic T Parse<T>(in DecodingContext context, LengthFormat lengthFormat, NumberStyles style, IFormatProvider? provider = null, MemoryAllocator<char>? allocator = null) 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.
Returns Type Description TThe result of parsing.
Type Parameters Name Description TThe numeric type.
Exceptions | Edit this page View Source Parse<TArg, TResult>(TArg, ReadOnlySpanFunc<char, TArg, TResult>, in DecodingContext, LengthFormat, MemoryAllocator<char>?)Parses a block of characters.
Declarationpublic TResult Parse<TArg, TResult>(TArg arg, ReadOnlySpanFunc<char, TArg, TResult> parser, in DecodingContext context, LengthFormat lengthFormat, MemoryAllocator<char>? allocator = null)
Parameters Type Name Description TArg arg
The argument to be passed to parser
.
The parser.
DecodingContext contextThe 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.
Returns Type Description TResultThe parsed block of characters.
Type Parameters Name Description TArgThe type of the argument to be passed to parser
.
The type of the parsing result.
Exceptions | Edit this page View Source Read(long)Reads the specified number of bytes.
Declarationpublic ReadOnlySequence<byte> Read(long count)
Parameters Type Name Description long count
The number of bytes to read.
Returns Exceptions | Edit this page View Source Read(Span<byte>)Copies the bytes from the sequence into contiguous block of memory.
Declarationpublic void Read(Span<byte> output)
Parameters Type Name Description Span<byte> output
The block of memory to fill.
Exceptions | Edit this page View Source ReadBigEndian<T>()Reads integer encoded in big-endian format.
Declarationpublic T ReadBigEndian<T>() where T : IBinaryInteger<T>
Returns Type Description T
The integer value.
Type Parameters Name Description TThe integer type.
Exceptions Type Condition EndOfStreamExceptionThe underlying source doesn't contain necessary amount of bytes to decode the value.
| Edit this page View Source ReadBlock(LengthFormat)Reads length-prefixed block of bytes.
Declarationpublic ReadOnlySequence<byte> ReadBlock(LengthFormat lengthFormat)
Parameters Type Name Description LengthFormat lengthFormat
The format of the block length encoded in the underlying stream.
Returns Exceptions | Edit this page View Source ReadBlock(LengthFormat, MemoryAllocator<byte>?)Reads length-prefixed block of bytes.
Declarationpublic MemoryOwner<byte> ReadBlock(LengthFormat lengthFormat, MemoryAllocator<byte>? allocator)
Parameters Type Name Description LengthFormat lengthFormat
The format of the block length encoded in the underlying stream.
MemoryAllocator<byte> allocatorThe memory allocator used to place the decoded block of bytes.
Returns Exceptions | Edit this page View Source ReadByte()Reads single byte.
Declaration Returns Type Description byteA byte.
Exceptions | Edit this page View Source ReadLittleEndian<T>()Reads integer encoded in little-endian format.
Declarationpublic T ReadLittleEndian<T>() where T : IBinaryInteger<T>
Returns Type Description T
The integer value.
Type Parameters Name Description TThe integer type.
Exceptions Type Condition EndOfStreamExceptionThe underlying source doesn't contain necessary amount of bytes to decode the value.
| Edit this page View Source ReadToEnd()Gets unread part of the buffer and advances the current reader to the end of the buffer.
Declarationpublic ReadOnlySequence<byte> ReadToEnd()
Returns | Edit this page View Source Read<T>()
Parses the value encoded as a sequence of bytes.
Declarationpublic T Read<T>() where T : IBinaryFormattable<T>
Returns Type Description T
The parsed value.
Type Parameters Name Description TThe type of the result.
| Edit this page View Source Reset()Resets the reader so it can be used again.
Declaration | Edit this page View Source Skip(long)Skips the specified number of bytes.
Declarationpublic void Skip(long length)
Parameters Type Name Description long length
The number of bytes to skip.
Exceptions | Edit this page View Source ToString()Returns the fully qualified type name of this instance.
Declarationpublic override readonly string ToString()
Returns Type Description string
The fully qualified type name.
Overrides | Edit this page View Source TryRead(int, out ReadOnlyMemory<byte>)Tries to read the next chunk.
Declarationpublic bool TryRead(int maxLength, out ReadOnlyMemory<byte> chunk)
Parameters Type Name Description int maxLength
The maximum length of the requested chunk.
ReadOnlyMemory<byte> chunkThe chunk of bytes. Its length is less than or equal to maxLength
.
true if next chunk is obtained successfully; false if the end of the stream reached.
| Edit this page View Source TryRead(out ReadOnlyMemory<byte>)Tries to read the next chunk.
Declarationpublic bool TryRead(out ReadOnlyMemory<byte> chunk)
Parameters Returns Type Description bool
true if the next chunk is obtained successfully; false if the end of the stream reached.
Implements 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