public SpanReader ReadAsSubReader(int length) { var reader = new SpanReader(_span.Slice(0, length)); Advance(length); return(reader); }
public Slot[] ReadAsSlotArray(int length) { var array = new Slot[length]; var subReader = new SpanReader(_span); for (int i = 0; i < array.Length; i++) { array[i] = subReader.ReadAsSlot(); } _span = subReader._span; return(array); }
public uint[] ReadAsVarIntArray(int length) { var array = new uint[length]; var subReader = new SpanReader(_span); for (int i = 0; i < array.Length; i++) { array[i] = subReader.ReadAsVarInt(out _); } _span = subReader._span; return(array); }
public T[] ReadAsArray <T>(int count) where T : IPacket, new() { var array = new T[count]; var subReader = new SpanReader(_span); for (int i = 0; i < array.Length; i++) { var item = new T(); item.Deserialize(ref subReader); array[i] = item; } _span = subReader._span; return(array); }