Table of Contents

Struct ReadOnlyRowBuffer

Namespace
MarymoorStudios.Core.Serialization.System
Assembly
MarymoorStudios.Core.Serialization.dll
public struct ReadOnlyRowBuffer
Inherited Members

Constructors

ReadOnlyRowBuffer(ReadOnlyMemory<byte>)

public ReadOnlyRowBuffer(ReadOnlyMemory<byte> buffer = default)

Parameters

buffer ReadOnlyMemory<byte>

Properties

Capacity

The remaining unused portion of the current buffer allocation.

public readonly int Capacity { get; }

Property Value

int

Length

The length of the written portion of the buffer.

public readonly int Length { get; }

Property Value

int

Remain

The remaining content not yet read.

public readonly ReadOnlyMemory<byte> Remain { get; }

Property Value

ReadOnlyMemory<byte>

Methods

Reset(int)

Resets the current read offset to 0.

public void Reset(int offset = 0)

Parameters

offset int

Skip(int)

Moves the offset forward.

public void Skip(int length)

Parameters

length int

The number of bytes to move forward.

TryRead(out TypeId)

public bool TryRead(out TypeId value)

Parameters

value TypeId

Returns

bool

TryRead(Span<byte>, out int)

Tries to read a byte array into the provided destination.

public bool TryRead(Span<byte> destination, out int written)

Parameters

destination Span<byte>

Where bytes should be written.

written int

The number of bytes written.

Returns

bool

True if successful, false otherwise.

Remarks

If destination is not large enough then returns , but sets written to the size required.

If no length can be read from the ReadOnlyRowBuffer then returns , but sets written to -1.

TryRead(out string)

public bool TryRead(out string value)

Parameters

value string

Returns

bool

TryRead<T>(Span<T>)

Tries to read a fixed sized byte array into the provided destination.

public bool TryRead<T>(Span<T> destination) where T : unmanaged

Parameters

destination Span<T>

Where bytes should be written.

Returns

bool

True if successful, false otherwise.

Type Parameters

T

TryRead<T>(out T)

public bool TryRead<T>(out T value) where T : unmanaged

Parameters

value T

Returns

bool

Type Parameters

T