Skip to content

SegmentBuilder Methods

Utility class for encoding data into an ArraySegment.

Append(ArraySegment<byte>, int, ReadOnlySpan<byte>)

static
View source
public static void Append(ArraySegment<byte> segment, ref int writerOffset, ReadOnlySpan<byte> bytes)
Appends a System.ReadOnlyMemory of bytes to the end of the segment

Parameters

segmentArraySegment<byte>
writerOffsetint
bytesReadOnlySpan<byte>

CalculateAppendSize(string)

static
View source
public static int CalculateAppendSize(string str)
Calculates how much space will be needed to append the provided string into the segment.

Parameters

strstring

ReadNextBytes(ArraySegment<byte>, int)

static
View source
public static ArraySegment<byte> ReadNextBytes(ArraySegment<byte> segment, ref int readerOffset)
Reads the next item in the segment as a byte array. For performance, this is returned as a sub-segment of the original segment.

Parameters

segmentArraySegment<byte>
readerOffsetint