<PackageReference Include="Azure.Storage.Blobs" Version="12.24.1" />

ArrayBufferWriter<T>

sealed class ArrayBufferWriter<T> : IBufferWriter<T>
Represents a heap-based, array-backed output sink into which data can be written.
public int Capacity { get; }

Returns the total amount of space within the underlying buffer.

public int FreeCapacity { get; }

Returns the amount of space available that can still be written into without forcing the underlying buffer to grow.

public int WrittenCount { get; }

Returns the amount of data written to the underlying buffer so far.

public ReadOnlyMemory<T> WrittenMemory { get; }

Returns the data written to the underlying buffer so far, as a ReadOnlyMemory<T>.

public ReadOnlySpan<T> WrittenSpan { get; }

Returns the data written to the underlying buffer so far, as a ReadOnlySpan<T>.

Creates an instance of an ArrayBufferWriter<T>, in which data can be written to, with the default initial capacity.

public ArrayBufferWriter(int initialCapacity)

Creates an instance of an ArrayBufferWriter<T>, in which data can be written to, with an initial capacity specified.

public void Advance(int count)

Notifies IBufferWriter<T> that count amount of data was written to the output Span<T>/ Memory<T>.

public void Clear()

Clears the data written to the underlying buffer.

public Memory<T> GetMemory(int sizeHint = 0)

Returns a Memory<T> to write to that is at least the requested length (specified by sizeHint). If no sizeHint is provided (or it's equal to 0), some non-empty buffer is returned.

public Span<T> GetSpan(int sizeHint = 0)

Returns a Span<T> to write to that is at least the requested length (specified by sizeHint). If no sizeHint is provided (or it's equal to 0), some non-empty buffer is returned.