DotNext by .NET Foundation and Contributors

<PackageReference Include="DotNext" Version="4.2.0" />

 SparseBufferWriter<T>

public bool IsSingleSegment { get; }

public long WrittenCount { get; }

public SparseBufferWriter(int chunkSize, SparseBufferGrowth growth = 0, MemoryAllocator<T> allocator = null)

public void Add(T item)

public void Clear()

public void CopyTo<TConsumer>(TConsumer consumer) where TConsumer : IReadOnlySpanConsumer<T>

public void CopyTo<TArg>(ReadOnlySpanAction<T, TArg> writer, TArg arg)

public int CopyTo(Span<T> output)

public bool TryGetWrittenContent(out ReadOnlyMemory segment)

public void Write(ReadOnlySpan<T> input)

public void Write(ReadOnlyMemory<T> input, bool copyMemory = true)

public void Write(ref ReadOnlySequence sequence, bool copyMemory = true)