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); }
void ISpanWriter.Sync(ref SpanWriter spanWriter) { _ofs = _bytes.Length - spanWriter.Buf.Length; }
public void Sync(ref SpanWriter spanWriter) { _pos = BufLength - spanWriter.Buf.Length; }
void ISpanWriter.Init(ref SpanWriter spanWriter) { spanWriter.Buf = _bytes.AsSpan(_ofs); }
public void Init(ref SpanWriter spanWriter) { spanWriter.Buf = _buf.AsSpan(_pos); spanWriter.HeapBuffer = _buf; }