Struct BinarySpanReader
- Namespace
- Vintagestory.API.Datastructures
- Assembly
- VintagestoryAPI.dll
public ref struct BinarySpanReader
- Inherited Members
- Extension Methods
Constructors
BinarySpanReader(ReadOnlySpan<byte>)
public BinarySpanReader(ReadOnlySpan<byte> data)
Parameters
dataReadOnlySpan<byte>
Properties
CurrentOffset
public readonly int CurrentOffset { get; }
Property Value
RemainingBytes
public readonly ReadOnlySpan<byte> RemainingBytes { get; }
Property Value
Methods
ReadBoolean()
public bool ReadBoolean()
Returns
Remarks
Equivalent to ReadBoolean().
This reads a whole byte to read one bool. If you have multiple bools you want to transport consider packing them into a large enough integer type.
A byte already has enough space to transport 8 bools by packing them into its bits.
This exists for convenience and parity with BinaryReader.
ReadByte()
public byte ReadByte()
Returns
ReadBytes(int)
public ReadOnlySpan<byte> ReadBytes(int count)
Parameters
countint
Returns
ReadDouble()
public double ReadDouble()
Returns
ReadFloat16BE()
public Half ReadFloat16BE()
Returns
ReadFloat16LE()
public Half ReadFloat16LE()
Returns
Remarks
Equivalent to ReadHalf()
ReadFloat32BE()
public float ReadFloat32BE()
Returns
ReadFloat32LE()
public float ReadFloat32LE()
Returns
Remarks
Equivalent to ReadSingle()
ReadFloat64BE()
public double ReadFloat64BE()
Returns
ReadFloat64LE()
public double ReadFloat64LE()
Returns
Remarks
Equivalent to ReadDouble()
ReadHalf()
public Half ReadHalf()
Returns
ReadInt16()
public short ReadInt16()
Returns
ReadInt16BE()
public short ReadInt16BE()
Returns
ReadInt16LE()
public short ReadInt16LE()
Returns
Remarks
Equivalent to ReadInt16()
ReadInt32()
public int ReadInt32()
Returns
ReadInt32BE()
public int ReadInt32BE()
Returns
ReadInt32LE()
public int ReadInt32LE()
Returns
Remarks
Equivalent to ReadInt32()
ReadInt64()
public long ReadInt64()
Returns
ReadInt64BE()
public long ReadInt64BE()
Returns
ReadInt64LE()
public long ReadInt64LE()
Returns
Remarks
Equivalent to ReadInt64()
ReadInt8BE()
public sbyte ReadInt8BE()
Returns
Remarks
Identical to ReadUInt8LE(). There are two methods for name parity with other operations.
ReadInt8LE()
public sbyte ReadInt8LE()
Returns
Remarks
Equivalent to ReadByte().
Identical to ReadInt8BE(). There are two methods for name parity with other operations.
ReadSByte()
public sbyte ReadSByte()
Returns
ReadSingle()
public float ReadSingle()
Returns
ReadString(int)
public string ReadString(int byteLengthLimit = 2147483647)
Parameters
byteLengthLimitintSince this method allocates memory form potentially untrusted data you can restrict the byte size of said allocation. Should the data contain a length for the string larger than this parameters value a FormatException is thrown.
Returns
Remarks
Equivalent to ReadString().
ReadUInt16()
public ushort ReadUInt16()
Returns
ReadUInt16BE()
public ushort ReadUInt16BE()
Returns
ReadUInt16LE()
public ushort ReadUInt16LE()
Returns
Remarks
Equivalent to ReadUInt16()
ReadUInt32()
public uint ReadUInt32()
Returns
ReadUInt32BE()
public uint ReadUInt32BE()
Returns
ReadUInt32LE()
public uint ReadUInt32LE()
Returns
Remarks
Equivalent to ReadUInt32()
ReadUInt64()
public ulong ReadUInt64()
Returns
ReadUInt64BE()
public ulong ReadUInt64BE()
Returns
ReadUInt64LE()
public ulong ReadUInt64LE()
Returns
Remarks
Equivalent to ReadUInt64()
ReadUInt8BE()
public byte ReadUInt8BE()
Returns
Remarks
Identical to ReadUInt8LE(). There are two methods for name parity with other operations.
ReadUInt8LE()
public byte ReadUInt8LE()
Returns
Remarks
Equivalent to ReadSByte().
Identical to ReadUInt8BE(). There are two methods for name parity with other operations.
SkipBytes(int)
public void SkipBytes(int count)
Parameters
countint