Пример #1
0
 public ReadableBufferReader(ReadCursor start, ReadCursor end) : this()
 {
     _end           = false;
     _index         = 0;
     _overallIndex  = 0;
     _enumerator    = new MemoryEnumerator(start, end);
     _currentMemory = default(Span <byte>);
     while (_enumerator.MoveNext())
     {
         if (!_enumerator.Current.IsEmpty)
         {
             _currentMemory = _enumerator.Current.Span;
             return;
         }
     }
     _end = true;
 }
Пример #2
0
 public ReadableBufferReader(ReadableBuffer buffer)
 {
     _end           = false;
     _index         = 0;
     _overallIndex  = 0;
     _enumerator    = buffer.GetEnumerator();
     _currentMemory = default(Span <byte>);
     while (_enumerator.MoveNext())
     {
         if (!_enumerator.Current.IsEmpty)
         {
             _currentMemory = _enumerator.Current.Span;
             return;
         }
     }
     _end = true;
 }