예제 #1
0
        bool ISpanWriter.Flush(ref SpanWriter spanWriter)
        {
            ((ISpanWriter)this).Sync(ref spanWriter);
            var newLength = Math.Min(Math.Max(_bytes.Length * 2, 32), int.MaxValue);

            if (_bytes.Length == newLength)
            {
                throw new BTDBException("ContinuousMemoryBlockWriter reached maximum size of " + int.MaxValue);
            }
            Array.Resize(ref _bytes, newLength);
            ((ISpanWriter)this).Init(ref spanWriter);
            return(true);
        }
예제 #2
0
 void ISpanWriter.Sync(ref SpanWriter spanWriter)
 {
     _ofs = _bytes.Length - spanWriter.Buf.Length;
 }
예제 #3
0
 public void Sync(ref SpanWriter spanWriter)
 {
     _pos = BufLength - spanWriter.Buf.Length;
 }
예제 #4
0
 void ISpanWriter.Init(ref SpanWriter spanWriter)
 {
     spanWriter.Buf = _bytes.AsSpan(_ofs);
 }
예제 #5
0
 public void Init(ref SpanWriter spanWriter)
 {
     spanWriter.Buf        = _buf.AsSpan(_pos);
     spanWriter.HeapBuffer = _buf;
 }