SequenceReader<T> 结构
定义
提供从 ReadOnlySequence<T> 读取二进制数据和文本数据的方法,重点关注性能和最小或零堆分配。Provides methods for reading binary and text data out of a ReadOnlySequence<T> with a focus on performance and minimal or zero heap allocations.
generic <typename T>
where T : value classpublic value class SequenceReader
public struct SequenceReader<T> where T : struct
type SequenceReader<'T (requires 'T : struct)> = struct
Public Structure SequenceReader(Of T)
类型参数
- T
只读序列的类型。The type of the read-only sequence.
- 继承
构造函数
| SequenceReader<T>(ReadOnlySequence<T>) |
根据给定 ReadOnlySequence<T> 创建 SequenceReader<T>。Creates a SequenceReader<T> over a given ReadOnlySequence<T>. |
属性
| Consumed |
获取由读取器处理的 |
| CurrentSpan |
获取 Span<T>,它包含 Sequence 中的当前段。Gets a Span<T> that contains the current segment in the Sequence. |
| CurrentSpanIndex |
获取 CurrentSpan 中的索引。Gets the index in the CurrentSpan. |
| End |
获取一个值,该值指示 Sequence 中是否不再有数据。Gets a value that indicates whether there is no more data in the Sequence. |
| Length |
获取读取器的 Sequence 中的项数。Gets the count of items in the reader's Sequence. |
| Position |
获取 Sequence 中的当前位置。Gets the current position in the Sequence. |
| Remaining |
获取读取器的 Sequence 中的剩余项。Gets the remaining items in the reader's Sequence. |
| Sequence |
获取读取器的基础 ReadOnlySequence<T>。Gets the underlying ReadOnlySequence<T> for the reader. |
| UnreadSequence | |
| UnreadSpan |
获取 CurrentSpan 的未读取部分。Gets the unread portion of the CurrentSpan. |
方法
| Advance(Int64) |
将读取器向前移动指定的项数。Moves the reader ahead a specified number of items. |
| AdvancePast(T) |
向前跳过具有给定 |
| AdvancePastAny(ReadOnlySpan<T>) |
跳过具有任何指定 |
| AdvancePastAny(T, T) |
向前跳过具有两个指定值之一的连续实例。Advances past consecutive instances of either of two specified values. |
| AdvancePastAny(T, T, T) |
向前跳过具有三个指定值之一的连续实例。Advances past consecutive instances of any of three specified values. |
| AdvancePastAny(T, T, T, T) |
向前跳过具有四个指定值之一的连续实例。Advances past consecutive instances of any of four specified values. |
| AdvanceToEnd() |
将读取器移动到序列末尾。Moves the reader to the end of the sequence. |
| IsNext(ReadOnlySpan<T>, Boolean) |
检查在只读范围中指定的值是否是序列中的下一个值。Checks whether the values specified in a read-only span are next in the sequence. |
| IsNext(T, Boolean) |
检查指定值是否是序列中的下一个值。Checks whether a specified value is next in the sequence. |
| Rewind(Int64) |
将读取器向后移动指定的项数。Moves the reader back the specified number of items. |
| TryAdvanceTo(T, Boolean) |
搜索指定的分隔符,并在找到该分隔符后向前越过它(可选)。Searches for a specified delimiter and optionally advances past it if it is found. |
| TryAdvanceToAny(ReadOnlySpan<T>, Boolean) |
搜索大量指定分隔符中的任意分隔符,并向前越过找到的第一个分隔符(可选)。Searches for any of a number of specified delimiters and optionally advances past the first one to be found. |
| TryCopyTo(Span<T>) |
如果有足够的数据来填充目标范围,则将当前位置的数据复制到目标范围。Copies data from the current position to the given destination span if there is enough data to fill it. |
| TryPeek(Int64, T) |
查看指定偏移量处的下一个值,而不前移读取器。Peeks at the next value at the specified offset without advancing the reader. |
| TryPeek(T) |
查看下一个值,而不前移读取器。Peeks at the next value without advancing the reader. |
| TryRead(T) |
读取下一个值,并前移读取器。Reads the next value and advance the reader. |
| TryReadTo(ReadOnlySequence<T>, ReadOnlySpan<T>, Boolean) |
尝试读取数据,直到指定为只读范围的整个分隔符匹配。Tries to read data until the entire delimiter specified as a read-only span matches. |
| TryReadTo(ReadOnlySequence<T>, T, Boolean) |
尝试读取给定 |
| TryReadTo(ReadOnlySequence<T>, T, T, Boolean) |
尝试读取给定 |
| TryReadTo(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean) |
尝试读取给定 |
| TryReadTo(ReadOnlySpan<T>, T, Boolean) |
尝试读取给定 |
| TryReadTo(ReadOnlySpan<T>, T, T, Boolean) |
尝试读取给定 |
| TryReadToAny(ReadOnlySequence<T>, ReadOnlySpan<T>, Boolean) |
尝试读取指定的任意 |
| TryReadToAny(ReadOnlySpan<T>, ReadOnlySpan<T>, Boolean) |
尝试读取指定的任意 |