コード例 #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;
 }