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

Method Encode

csharp/src/Fory/TypeMeta.cs:469–488  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

467 }
468
469 public byte[] Encode()
470 {
471 if (Compressed)
472 {
473 throw new EncodingException("compressed TypeMeta is not supported yet");
474 }
475
476 byte[] body = EncodeBody();
477 ulong headerLowBits = ComputeHeaderLowBits(body.Length, compressed: false);
478 ulong header = ComputeHeaderHashBits(body, headerLowBits) | headerLowBits;
479 ByteWriter writer = new(body.Length + 16);
480 writer.WriteUInt64(header);
481 if (body.Length >= (int)TypeMetaConstants.TypeMetaSizeMask)
482 {
483 writer.WriteVarUInt32((uint)(body.Length - (int)TypeMetaConstants.TypeMetaSizeMask));
484 }
485
486 writer.WriteBytes(body);
487 return writer.ToArray();
488 }
489
490 public static TypeMeta Decode(byte[] bytes)
491 {

Callers 12

WriteTypeMetaMethod · 0.45
WriteMethod · 0.45
WriteNameMethod · 0.45
RegisterMethod · 0.45
WriteMetaStringMethod · 0.45
ReadAndStoreTypeMetaMethod · 0.45
ReadAnyTypeInfoMethod · 0.45
EncodedTypeMetaHeaderMethod · 0.45

Calls 4

WriteUInt64Method · 0.80
WriteVarUInt32Method · 0.80
ToArrayMethod · 0.80
WriteBytesMethod · 0.45