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
intRead offset reference
Properties
Capacity
Total buffer capacity in bytes.
public int Capacity { get; }
Property Value
CurrentBuffer
Returns a Span<T> for the current available buffer.
public ReadOnlySpan<byte> CurrentBuffer { get; }
Property Value
Endianness
Gets or init the value to define which endianness should be used for serialization.
public Endianness Endianness { get; init; }
Property Value
FreeCapacity
Available buffer space in bytes
public int FreeCapacity { get; }
Property Value
ReadCount
Total read byte count.
public int ReadCount { get; }
Property Value
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
ReadBoolean(in Span<bool>)
Reads a span of bool from buffer into values
.
public void ReadBoolean(in Span<bool> values)
Parameters
ReadByte()
Reads single byte from buffer.
public byte ReadByte()
Returns
ReadByte(in Span<byte>)
Reads a span of byte from buffer into values
.
public void ReadByte(in Span<byte> values)
Parameters
ReadChar()
Reads single char from buffer.
public char ReadChar()
Returns
ReadChar(in Span<char>)
Reads a span of char from buffer into values
.
public void ReadChar(in Span<char> values)
Parameters
ReadDouble()
Reads single double from buffer.
public double ReadDouble()
Returns
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
ReadInt128()
Reads single Int128 from buffer.
public Int128 ReadInt128()
Returns
ReadInt128(in Span<Int128>)
Reads a span of Int128 from buffer into values
.
public void ReadInt128(in Span<Int128> values)
Parameters
ReadInt16()
Reads single short from buffer.
public short ReadInt16()
Returns
ReadInt16(in Span<short>)
Reads a span of short from buffer into values
.
public void ReadInt16(in Span<short> values)
Parameters
ReadInt32()
Reads single int from buffer.
public int ReadInt32()
Returns
ReadInt32(in Span<int>)
Reads a span of int from buffer into values
.
public void ReadInt32(in Span<int> values)
Parameters
ReadInt64()
Reads single long from buffer.
public long ReadInt64()
Returns
ReadInt64(in Span<long>)
Reads a span of long from buffer into values
.
public void ReadInt64(in Span<long> values)
Parameters
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
booltrue 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
ReadSByte()
Reads single sbyte from buffer.
public sbyte ReadSByte()
Returns
ReadSByte(in Span<sbyte>)
Reads a span of sbyte from buffer into values
.
public void ReadSByte(in Span<sbyte> values)
Parameters
ReadSingle()
Reads single float from buffer.
public float ReadSingle()
Returns
ReadUInt128()
Reads single UInt128 from buffer.
public UInt128 ReadUInt128()
Returns
ReadUInt128(in Span<UInt128>)
Reads a span of UInt128 from buffer into values
.
public void ReadUInt128(in Span<UInt128> values)
Parameters
ReadUInt16()
Reads single ushort from buffer.
public ushort ReadUInt16()
Returns
ReadUInt16(in Span<ushort>)
Reads a span of ushort from buffer into values
.
public void ReadUInt16(in Span<ushort> values)
Parameters
ReadUInt32()
Reads single uint from buffer.
public uint ReadUInt32()
Returns
ReadUInt32(in Span<uint>)
Reads a span of uint from buffer into values
.
public void ReadUInt32(in Span<uint> values)
Parameters
ReadUInt64()
Reads single ulong from buffer.
public ulong ReadUInt64()
Returns
ReadUInt64(in Span<ulong>)
Reads a span of ulong from buffer into values
.
public void ReadUInt64(in Span<ulong> values)
Parameters
ReadVector2()
Reads single Vector2 from buffer.
public Vector2 ReadVector2()
Returns
ReadVector3()
Reads single Vector3 from buffer.
public Vector3 ReadVector3()
Returns
ReadVector4()
Reads single Vector4 from buffer.
public Vector4 ReadVector4()