DotNext by .NET Foundation and Contributors

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

.NET API 516,040 bytes

 BufferWriter<T>

Represents memory-backed output sink which T data can be written.
public abstract int Capacity { get; set; }

Gets or sets the total amount of space within the underlying memory.

public int FreeCapacity { get; }

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

public T& modreq(System.Runtime.InteropServices.InAttribute) this[int index] { get; }

Gets the element at the specified index.

public int WrittenCount { get; set; }

Gets or sets the amount of data written to the underlying memory so far.

public abstract ReadOnlyMemory<T> WrittenMemory { get; }

Gets the data written to the underlying buffer so far.

public void Add(T item)

Writes single element.

public virtual void AddAll(ICollection<T> items)

Writes multiple elements.

public void Advance(int count)

Notifies this writer that count of data items were written.

public abstract void Clear(bool reuseBuffer = false)

Clears the data written to the underlying memory.

public abstract MemoryOwner<T> DetachBuffer()

Transfers ownership of the written memory from this writer to the caller.

Gets enumerator over all written elements.

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

Returns the memory to write to that is at least the requested size.

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

Returns the memory to write to that is at least the requested size.

public void Rewind(int count)

Moves the writer back the specified number of items.