Skip to content

SpanBufferWriter Methods

A special-purpose System.Buffers.IBufferWriter implementation for supporting System.Span in Orleans.Serialization.Buffers.Writer.

Advance(int)

View source
public void Advance(int count)
Notifies the System.Buffers.IBufferWriter that count data items were written to the output System.Span or System.Memory.

Parameters

countint
The number of data items written to the System.Span or System.Memory.

GetMemory(int)

View source
public readonly Memory<byte> GetMemory(int sizeHint = 0)
Returns a System.Memory to write to that is at least the requested size (specified by sizeHint).

Parameters

sizeHintint
The minimum length of the returned System.Memory. If 0, a non-empty buffer is returned.

Returns

A System.Memory of at least the size sizeHint. If sizeHint is 0, returns a non-empty buffer.

Exceptions

System.OutOfMemoryException
The requested buffer size is not available.

GetSpan(int)

View source
public readonly Span<byte> GetSpan(int sizeHint = 0)
Returns a System.Span to write to that is at least the requested size (specified by sizeHint).

Parameters

sizeHintint
The minimum length of the returned System.Span. If 0, a non-empty buffer is returned.

Returns

A System.Span of at least the size sizeHint. If sizeHint is 0, returns a non-empty buffer.