Table of Contents

Struct BinarySpanWriter

Namespace
Backdash.Serialization.Buffer
Assembly
Backdash.dll

Binary span writer.

public readonly ref struct BinarySpanWriter
Inherited Members

Constructors

BinarySpanWriter(scoped in Span<byte>, ref int)

Initialize a new BinarySpanWriter for buffer

public BinarySpanWriter(scoped in Span<byte> buffer, ref int offset)

Parameters

buffer Span<byte>

Byte buffer to be written

offset int

Write 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 Span<byte> CurrentBuffer { get; }

Property Value

Span<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

WrittenCount

Total written byte count.

public int WrittenCount { get; }

Property Value

int

Methods

Advance(int)

Advance write pointer by count.

public void Advance(int count)

Parameters

count int

Write(in bool)

Writes single boolvalue into buffer.

public void Write(in bool value)

Parameters

value bool

Write(in byte)

Writes single bytevalue into buffer.

public void Write(in byte value)

Parameters

value byte

Write(in char)

Writes single charvalue into buffer.

public void Write(in char value)

Parameters

value char

Write(in double)

Writes single doublevalue into buffer.

public void Write(in double value)

Parameters

value double

Write(in Half)

Writes single Halfvalue into buffer.

public void Write(in Half value)

Parameters

value Half

Write(in Int128)

Writes single Int128value into buffer.

public void Write(in Int128 value)

Parameters

value Int128

Write(in short)

Writes single shortvalue into buffer.

public void Write(in short value)

Parameters

value short

Write(in int)

Writes single intvalue into buffer.

public void Write(in int value)

Parameters

value int

Write(in long)

Writes single longvalue into buffer.

public void Write(in long value)

Parameters

value long

Write(in Quaternion)

Writes single Quaternionvalue into buffer.

public void Write(in Quaternion value)

Parameters

value Quaternion

Write(in Vector2)

Writes single Vector2value into buffer.

public void Write(in Vector2 value)

Parameters

value Vector2

Write(in Vector3)

Writes single Vector3value into buffer.

public void Write(in Vector3 value)

Parameters

value Vector3

Write(in Vector4)

Writes single Vector4value into buffer.

public void Write(in Vector4 value)

Parameters

value Vector4

Write(in ReadOnlySpan<bool>)

Writes a span of boolvalue into buffer.

public void Write(in ReadOnlySpan<bool> value)

Parameters

value ReadOnlySpan<bool>

Write(in ReadOnlySpan<byte>)

Writes a span of bytevalue into buffer.

public void Write(in ReadOnlySpan<byte> value)

Parameters

value ReadOnlySpan<byte>

Write(in ReadOnlySpan<char>)

Writes a span of charvalue into buffer.

public void Write(in ReadOnlySpan<char> value)

Parameters

value ReadOnlySpan<char>

Write(in ReadOnlySpan<Int128>)

Writes a span of Int128value into buffer.

public void Write(in ReadOnlySpan<Int128> value)

Parameters

value ReadOnlySpan<Int128>

Write(in ReadOnlySpan<short>)

Writes a span of shortvalue into buffer.

public void Write(in ReadOnlySpan<short> value)

Parameters

value ReadOnlySpan<short>

Write(in ReadOnlySpan<int>)

Writes a span of intvalue into buffer.

public void Write(in ReadOnlySpan<int> value)

Parameters

value ReadOnlySpan<int>

Write(in ReadOnlySpan<long>)

Writes a span of longvalue into buffer.

public void Write(in ReadOnlySpan<long> value)

Parameters

value ReadOnlySpan<long>

Write(in ReadOnlySpan<sbyte>)

Writes a span of sbytevalue into buffer.

public void Write(in ReadOnlySpan<sbyte> value)

Parameters

value ReadOnlySpan<sbyte>

Write(in ReadOnlySpan<UInt128>)

Writes a span of UInt128value into buffer.

public void Write(in ReadOnlySpan<UInt128> value)

Parameters

value ReadOnlySpan<UInt128>

Write(in ReadOnlySpan<ushort>)

Writes a span of ushortvalue into buffer.

public void Write(in ReadOnlySpan<ushort> value)

Parameters

value ReadOnlySpan<ushort>

Write(in ReadOnlySpan<uint>)

Writes a span of uintvalue into buffer.

public void Write(in ReadOnlySpan<uint> value)

Parameters

value ReadOnlySpan<uint>

Write(in ReadOnlySpan<ulong>)

Writes a span of ulongvalue into buffer.

public void Write(in ReadOnlySpan<ulong> value)

Parameters

value ReadOnlySpan<ulong>

Write(in sbyte)

Writes single sbytevalue into buffer.

public void Write(in sbyte value)

Parameters

value sbyte

Write(in float)

Writes single floatvalue into buffer.

public void Write(in float value)

Parameters

value float

Write(in string)

Writes an stringvalue into buffer as UTF8.

public void Write(in string value)

Parameters

value string

Write(in UInt128)

Writes single UInt128value into buffer.

public void Write(in UInt128 value)

Parameters

value UInt128

Write(in ushort)

Writes single ushortvalue into buffer.

public void Write(in ushort value)

Parameters

value ushort

Write(in uint)

Writes single uintvalue into buffer.

public void Write(in uint value)

Parameters

value uint

Write(in ulong)

Writes single ulongvalue into buffer.

public void Write(in ulong value)

Parameters

value ulong

WriteEnum<T>(in T)

Writes the EnumenumValue into buffer.

public void WriteEnum<T>(in T enumValue) where T : unmanaged, Enum

Parameters

enumValue T

Type Parameters

T

An enum type.

WriteNumber<T>(in T)

Writes a IBinaryInteger<TSelf>value into buffer.

public void WriteNumber<T>(in T value) where T : unmanaged, IBinaryInteger<T>

Parameters

value T

Type Parameters

T

A numeric type that implements IBinaryInteger<TSelf>.