MCPcopy Create free account
hub / github.com/apache/fory / SkipMap

Method SkipMap

csharp/src/Fory/FieldSkipper.cs:372–458  ·  view source on GitHub ↗
(ReadContext context, TypeMetaFieldType fieldType)

Source from the content-addressed store, hash-verified

370 }
371
372 private static void SkipMap(ReadContext context, TypeMetaFieldType fieldType)
373 {
374 if (fieldType.Generics.Count != 2)
375 {
376 throw new InvalidDataException("map field metadata must have key/value types");
377 }
378
379 TypeMetaFieldType keyType = fieldType.Generics[0];
380 TypeMetaFieldType valueType = fieldType.Generics[1];
381 int totalLength = checked((int)context.Reader.ReadVarUInt32());
382 int readCount = 0;
383 while (readCount < totalLength)
384 {
385 byte header = context.Reader.ReadUInt8();
386 bool trackKeyRef = (header & DictionaryBits.TrackingKeyRef) != 0;
387 bool keyNull = (header & DictionaryBits.KeyNull) != 0;
388 bool keyDeclared = (header & DictionaryBits.DeclaredKeyType) != 0;
389 bool trackValueRef = (header & DictionaryBits.TrackingValueRef) != 0;
390 bool valueNull = (header & DictionaryBits.ValueNull) != 0;
391 bool valueDeclared = (header & DictionaryBits.DeclaredValueType) != 0;
392
393 if (keyNull || valueNull)
394 {
395 if (!keyNull)
396 {
397 TypeInfo? keyTypeInfo = null;
398 if (!keyDeclared)
399 {
400 keyTypeInfo = context.TypeResolver.ReadAnyTypeInfo(context);
401 }
402 else if (context.Compatible && HasInlineTypeInfo(keyType.TypeId))
403 {
404 keyTypeInfo = context.TypeResolver.ReadAnyTypeInfo(context);
405 }
406
407 SkipValue(context, keyType, trackKeyRef ? RefMode.Tracking : RefMode.None, keyTypeInfo);
408 }
409
410 if (!valueNull)
411 {
412 TypeInfo? valueTypeInfo = null;
413 if (!valueDeclared)
414 {
415 valueTypeInfo = context.TypeResolver.ReadAnyTypeInfo(context);
416 }
417 else if (context.Compatible && HasInlineTypeInfo(valueType.TypeId))
418 {
419 valueTypeInfo = context.TypeResolver.ReadAnyTypeInfo(context);
420 }
421
422 SkipValue(context, valueType, trackValueRef ? RefMode.Tracking : RefMode.None, valueTypeInfo);
423 }
424
425 readCount++;
426 continue;
427 }
428
429 int chunkSize = context.Reader.ReadUInt8();

Callers

nothing calls this directly

Calls 3

ReadVarUInt32Method · 0.80
ReadUInt8Method · 0.80
ReadAnyTypeInfoMethod · 0.45

Tested by

no test coverage detected