in modules/platforms/dotnet/Apache.Ignite/Internal/Proto/MsgPack/MsgPackReader.cs [228:366]
public Instant? ReadInstantNullable() => TryReadNil()
? null
: Instant.FromUnixTimeSeconds(ReadInt64()).PlusNanoseconds(ReadInt32());
/// <summary>
/// Skips a value.
/// </summary>
/// <param name="count">Count of elements to skip.</param>
public void Skip(int count = 1)
{
while (count > 0)
{
count--;
var code = _span[_pos++];
if (MsgPackCode.IsPosFixInt(code) || MsgPackCode.IsNegFixInt(code))
{
continue;
}
if (MsgPackCode.IsFixMap(code))
{
int mapLen = code & 0x0f;
count += mapLen * 2;
continue;
}
if (MsgPackCode.IsFixArr(code))
{
int arrayLen = code & 0x0f;
count += arrayLen;
continue;
}
if (MsgPackCode.IsFixStr(code))
{
int strLen = code & 0x1f;
_pos += strLen;
continue;
}
switch (code)
{
case MsgPackCode.True:
case MsgPackCode.False:
case MsgPackCode.Nil:
break;
case MsgPackCode.Int8:
case MsgPackCode.UInt8:
_pos++;
break;
case MsgPackCode.Int16:
case MsgPackCode.UInt16:
_pos += 2;
break;
case MsgPackCode.Int32:
case MsgPackCode.UInt32:
case MsgPackCode.Float32:
_pos += 4;
break;
case MsgPackCode.Int64:
case MsgPackCode.UInt64:
case MsgPackCode.Float64:
_pos += 8;
break;
case MsgPackCode.Bin8:
case MsgPackCode.Str8:
_pos += _span[_pos] + 1;
break;
case MsgPackCode.Bin16:
case MsgPackCode.Str16:
_pos = BinaryPrimitives.ReadUInt16BigEndian(GetSpan(2)) + _pos;
break;
case MsgPackCode.Bin32:
case MsgPackCode.Str32:
_pos = checked((int)BinaryPrimitives.ReadUInt32BigEndian(GetSpan(4))) + _pos;
break;
case MsgPackCode.FixExt1:
_pos += 2;
break;
case MsgPackCode.FixExt2:
_pos += 3;
break;
case MsgPackCode.FixExt4:
_pos += 5;
break;
case MsgPackCode.FixExt8:
_pos += 9;
break;
case MsgPackCode.FixExt16:
_pos += 17;
break;
case MsgPackCode.Ext8:
_pos += _span[_pos] + 2;
break;
case MsgPackCode.Ext16:
_pos = BinaryPrimitives.ReadUInt16BigEndian(GetSpan(2)) + 1 + _pos;
break;
case MsgPackCode.Ext32:
_pos = checked((int)BinaryPrimitives.ReadUInt32BigEndian(GetSpan(4))) + 1 + _pos;
break;
case MsgPackCode.Array16:
count += BinaryPrimitives.ReadUInt16BigEndian(GetSpan(2));
break;
case MsgPackCode.Array32:
count += checked((int)BinaryPrimitives.ReadUInt32BigEndian(GetSpan(4)));
break;
case MsgPackCode.Map16:
count += BinaryPrimitives.ReadUInt16BigEndian(GetSpan(2)) * 2;
break;
case MsgPackCode.Map32:
count += checked((int)BinaryPrimitives.ReadUInt32BigEndian(GetSpan(4)) * 2);
break;
default:
throw GetInvalidCodeException("valid type code", code);
}
}
}