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
Length
The length of the written portion of the buffer.
public readonly int Length { get; }
Property Value
Remain
The remaining content not yet read.
public readonly ReadOnlyMemory<byte> Remain { get; }
Property Value
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
intThe number of bytes to move forward.
TryRead(out TypeId)
public bool TryRead(out TypeId value)
Parameters
value
TypeId
Returns
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
Returns
- bool
True if successful, false otherwise.
Remarks
If destination
is not large enough then returns written
to the size required.
If no length can be read from the ReadOnlyRowBuffer then returns written
to -1
.
TryRead(out string)
public bool TryRead(out string value)
Parameters
value
string
Returns
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
Type Parameters
T