Table of Contents

Struct BinarySpanReader

Namespace
Backdash.Serialization.Buffer
Assembly
Backdash.dll

Binary span reader.

public readonly ref struct BinarySpanReader
Inherited Members

Constructors

BinarySpanReader(ReadOnlySpan<byte>, ref int)

Initialize a new BinarySpanReader for buffer

public BinarySpanReader(ReadOnlySpan<byte> buffer, ref int offset)

Parameters

buffer ReadOnlySpan<byte>

Byte buffer to be read

offset int

Read offset reference

Properties

Capacity

Total buffer capacity in bytes.

public int Capacity { get; }

Property Value

int

CurrentBuffer

Returns a Span<T> for the current available buffer.

public ReadOnlySpan<byte> CurrentBuffer { get; }

Property Value

ReadOnlySpan<byte>

Endianness

Gets or init the value to define which endianness should be used for serialization.

public Endianness Endianness { get; init; }

Property Value

Endianness

FreeCapacity

Available buffer space in bytes

public int FreeCapacity { get; }

Property Value

int

ReadCount

Total read byte count.

public int ReadCount { get; }

Property Value

int

Methods

Advance(int)

Advance read pointer by count.

public void Advance(int count)

Parameters

count int

ReadBoolean()

Reads single bool from buffer.

public bool ReadBoolean()

Returns

bool

ReadBoolean(in Span<bool>)

Reads a span of bool from buffer into values.

public void ReadBoolean(in Span<bool> values)

Parameters

values Span<bool>

ReadByte()

Reads single byte from buffer.

public byte ReadByte()

Returns

byte

ReadByte(in Span<byte>)

Reads a span of byte from buffer into values.

public void ReadByte(in Span<byte> values)

Parameters

values Span<byte>

ReadChar()

Reads single char from buffer.

public char ReadChar()

Returns

char

ReadChar(in Span<char>)

Reads a span of char from buffer into values.

public void ReadChar(in Span<char> values)

Parameters

values Span<char>

ReadDouble()

Reads single double from buffer.

public double ReadDouble()

Returns

double

ReadEnum<T>()

Reads single Enum value from buffer.

public T ReadEnum<T>() where T : unmanaged, Enum

Returns

T

Type Parameters

T

An enum type.

ReadHalf()

Reads single Half from buffer.

public Half ReadHalf()

Returns

Half

ReadInt128()

Reads single Int128 from buffer.

public Int128 ReadInt128()

Returns

Int128

ReadInt128(in Span<Int128>)

Reads a span of Int128 from buffer into values.

public void ReadInt128(in Span<Int128> values)

Parameters

values Span<Int128>

ReadInt16()

Reads single short from buffer.

public short ReadInt16()

Returns

short

ReadInt16(in Span<short>)

Reads a span of short from buffer into values.

public void ReadInt16(in Span<short> values)

Parameters

values Span<short>

ReadInt32()

Reads single int from buffer.

public int ReadInt32()

Returns

int

ReadInt32(in Span<int>)

Reads a span of int from buffer into values.

public void ReadInt32(in Span<int> values)

Parameters

values Span<int>

ReadInt64()

Reads single long from buffer.

public long ReadInt64()

Returns

long

ReadInt64(in Span<long>)

Reads a span of long from buffer into values.

public void ReadInt64(in Span<long> values)

Parameters

values Span<long>

ReadNumber<T>()

Reads single IBinaryInteger<TSelf> from buffer.

public T ReadNumber<T>() where T : unmanaged, IBinaryInteger<T>, IMinMaxValue<T>

Returns

T

Type Parameters

T

A numeric type that implements IBinaryInteger<TSelf> and IMinMaxValue<TSelf>.

ReadNumber<T>(bool)

Reads single IBinaryInteger<TSelf> from buffer.

public T ReadNumber<T>(bool isUnsigned) where T : unmanaged, IBinaryInteger<T>

Parameters

isUnsigned bool

true if source represents an unsigned two's complement number; otherwise, false to indicate it represents a signed two's complement number

Returns

T

Type Parameters

T

A numeric type that implements IBinaryInteger<TSelf>.

ReadQuaternion()

Reads single Quaternion from buffer.

public Quaternion ReadQuaternion()

Returns

Quaternion

ReadSByte()

Reads single sbyte from buffer.

public sbyte ReadSByte()

Returns

sbyte

ReadSByte(in Span<sbyte>)

Reads a span of sbyte from buffer into values.

public void ReadSByte(in Span<sbyte> values)

Parameters

values Span<sbyte>

ReadSingle()

Reads single float from buffer.

public float ReadSingle()

Returns

float

ReadUInt128()

Reads single UInt128 from buffer.

public UInt128 ReadUInt128()

Returns

UInt128

ReadUInt128(in Span<UInt128>)

Reads a span of UInt128 from buffer into values.

public void ReadUInt128(in Span<UInt128> values)

Parameters

values Span<UInt128>

ReadUInt16()

Reads single ushort from buffer.

public ushort ReadUInt16()

Returns

ushort

ReadUInt16(in Span<ushort>)

Reads a span of ushort from buffer into values.

public void ReadUInt16(in Span<ushort> values)

Parameters

values Span<ushort>

ReadUInt32()

Reads single uint from buffer.

public uint ReadUInt32()

Returns

uint

ReadUInt32(in Span<uint>)

Reads a span of uint from buffer into values.

public void ReadUInt32(in Span<uint> values)

Parameters

values Span<uint>

ReadUInt64()

Reads single ulong from buffer.

public ulong ReadUInt64()

Returns

ulong

ReadUInt64(in Span<ulong>)

Reads a span of ulong from buffer into values.

public void ReadUInt64(in Span<ulong> values)

Parameters

values Span<ulong>

ReadVector2()

Reads single Vector2 from buffer.

public Vector2 ReadVector2()

Returns

Vector2

ReadVector3()

Reads single Vector3 from buffer.

public Vector3 ReadVector3()

Returns

Vector3

ReadVector4()

Reads single Vector4 from buffer.

public Vector4 ReadVector4()

Returns

Vector4