/// <summary> /// Moves to the next <see cref="Buffer{Byte}"/> in the <see cref="ReadableBuffer"/> /// </summary> /// <returns></returns> public bool MoveNext() { if (!_segmentEnumerator.MoveNext()) { _current = default(Buffer <byte>); return(false); } var current = _segmentEnumerator.Current; _current = current.Segment.Buffer.Slice(current.Start, current.Length); return(true); }
private void MoveNext() { while (_enumerator.MoveNext()) { var part = _enumerator.Current; var length = part.Length; if (length != 0) { _currentSpan = part.Segment.Buffer.Span.Slice(part.Start, length); _index = 0; return; } } _end = true; }
public static int Seek(ReadCursor begin, ReadCursor end, out ReadCursor result, byte byte0) { var enumerator = new SegmentEnumerator(begin, end); while (enumerator.MoveNext()) { var segmentPart = enumerator.Current; var segment = segmentPart.Segment; var span = segment.Buffer.Span.Slice(segmentPart.Start, segmentPart.Length); int index = span.IndexOf(byte0); if (index != -1) { result = new ReadCursor(segment, segmentPart.Start + index); return(span[index]); } } result = end; return(-1); }