Protocol buffers 如何打印protobuf消息中的值
我知道有一种方法可以在protobuf中序列化消息。但是有没有一种简单的方法来打印protobuf消息中的值呢?类似于Java中的toString()方法 谢谢。 从链接中引用,检查Protocol buffers 如何打印protobuf消息中的值,protocol-buffers,Protocol Buffers,我知道有一种方法可以在protobuf中序列化消息。但是有没有一种简单的方法来打印protobuf消息中的值呢?类似于Java中的toString()方法 谢谢。 从链接中引用,检查标准消息方法: 标准消息方法 每个message and builder类还包含许多其他方法,可用于检查或操作整个消息,包括: isInitialized(): checks if all the required fields have been set. toString(): returns a human-
标准消息方法
:
标准消息方法
每个message and builder类还包含许多其他方法,可用于检查或操作整个消息,包括:
isInitialized(): checks if all the required fields have been set.
toString(): returns a human-readable representation of the message, particularly useful for debugging.
mergeFrom(Message other): (builder only) merges the contents of other into this message, overwriting singular fields and concatenating repeated ones.
clear(): (builder only) clears all the fields back to the empty state.
非常感谢,我是Protobuf的新手,仍在尝试了解一些非常基本的功能。谢谢你的帮助。我大约在一两年前使用过它,请看这里,一个非常简单的例子: