public static long SerializedSizeOfHeader(KafkaRecordHeader header) { header.Validate(); var keySize = Basics.SizeOfSerializedString(header.Key); return(keySize + header.Value.Length + VarIntConverter.SizeOfVarInt(keySize) + VarIntConverter.SizeOfVarInt(header.Value.Length)); }
public static ReusableMemoryStream SerializeHeader(ReusableMemoryStream target, KafkaRecordHeader header) { header.Validate(); Basics.SerializeStringWithVarIntSize(target, header.Key); Basics.SerializeBytesWithVarIntSize(target, header.Value); return(target); }