Ejemplo n.º 1
0
        public static int Seek(ReadCursor begin, ReadCursor end, out ReadCursor result, byte byte0, byte byte1, byte byte2)
        {
            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.IndexOfAny(byte0, byte1, byte2);

                if (index != -1)
                {
                    result = new ReadCursor(segment, segmentPart.Start + index);
                    return(span[index]);
                }
            }

            result = end;
            return(-1);
        }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 public BufferEnumerator(ReadCursor start, ReadCursor end)
 {
     _segmentEnumerator = new SegmentEnumerator(start, end);
     _current           = default(Buffer <byte>);
 }