SparseBufferWriter<T>
public class SparseBufferWriter<T> : Disposable, IGrowableBuffer<T>, IReadOnlySpanConsumer<T>, ISupplier<ReadOnlyMemory<T>, CancellationToken, ValueTask>, IFunctional<Func<ReadOnlyMemory<T>, CancellationToken, ValueTask>>, IDisposable, IResettable, ISupplier<ReadOnlySequence<T>>, IFunctional<Func<ReadOnlySequence<T>>>, IEnumerable<ReadOnlyMemory<T>>, IEnumerable, IBufferWriter<T>
Represents builder of the sparse memory buffer.
Represents enumerator over memory segments.
Gets the current write position within the buffer.
Gets a value indicating that this buffer consists of a single segment.
Gets the position of the first chunk of data within the buffer.
Gets the number of written elements.
public SparseBufferWriter(int chunkSize, SparseBufferGrowth growth = 0, MemoryAllocator<T> allocator = null)
Initializes a new builder with the specified size of memory block.
Initializes a new builder with automatically selected
chunk size.
public SparseBufferWriter()
Initializes a new builder which uses Shared
as a default allocator of buffers.
Adds a single item to the buffer.
Clears internal buffers so this builder can be reused.
Passes the contents of this builder to the consumer.
Passes the contents of this builder to the callback.
Copies the contents of this builder to the specified memory block.
Copies the elements from this buffer to the destination location, starting at the specified position,
and advances the position.
public void CopyTo<TConsumer>(TConsumer consumer, SequencePosition start) where TConsumer : IReadOnlySpanConsumer<T>
Passes the elements from this buffer to the specified consumer, starting at the specified position.
public long CopyTo<TConsumer>(TConsumer consumer, ref SequencePosition position, long count) where TConsumer : IReadOnlySpanConsumer<T>
Passes the elements from this buffer to the specified consumer, starting at the specified position,
and advances the position.
Gets enumerator over memory segments.
Returns a position at an offset from the specified position within this buffer.
Reads the data from this buffer, and advances the position to the specified number of elements.
Attempts to get the underlying buffer if it is presented by a single segment.
Writes the block of memory to this builder.
Writes the block of memory to this builder.
Writes a sequence of memory blocks to this builder.