System::Buffers::ArrayBufferWriter class

ArrayBufferWriter class

Represents a heap-based, array-backed output sink into which data can be written.

template<typename T>class ArrayBufferWriter : public System::Buffers::IBufferWriter<T>
ParameterDescription
TThe type of the elements held by the writer.

Methods

MethodDescription
Advance(int32_t) overrideNotifies the writer that count amount of data was written to the output Span/Memory.
ArrayBufferWriter()Creates an instance of an ArrayBufferWriter, in which data can be written to, with the default initial capacity.
explicit ArrayBufferWriter(int32_t)Creates an instance of an ArrayBufferWriter, in which data can be written to, with an initial capacity specified.
Clear()Clears the data written to the underlying buffer.
get_Capacity() constReturns the total amount of space within the underlying buffer.
get_FreeCapacity() constReturns the amount of space available that can still be written into without forcing the underlying buffer to grow.
get_WrittenCount() constReturns the amount of data written to the underlying buffer so far.
get_WrittenMemory() constReturns the data written to the underlying buffer so far, as a ReadOnlyMemory.
get_WrittenSpan() constReturns the data written to the underlying buffer so far, as a ReadOnlySpan.
GetMemory(int32_t) overrideReturns a Memory 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.
GetSpan(int32_t) overrideReturns a Span 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.
ResetWrittenCount()Resets the data written to the underlying buffer without zeroing its content.

See Also