Java 协议缓冲区 Ascii 序列化
这可能是一个愚蠢的问题,抱歉。 我最近开始使用 protobufs,但我似乎不知道如何解析协议缓冲区定义的消息中的 ascii 文件? ParseFrom(...) 似乎不起作用,因为它需要二进制序列化。
谢谢
It is probably a stupid question, sorry.
I recently started using protobufs and I do not seem to figure out how would I parse an ascii file in the protocol buffer defined message?
ParseFrom(...) does not seem to work cause it requires a binary serialization.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://code.google.com /apis/protocolbuffers/docs/reference/java/com/google/protobuf/TextFormat.html
确实,在生产/性能代码中,您应该只处理二进制形式的协议缓冲区,但为了调试或方便,有一种定义良好的人类可读格式,并且所有接口(python、java、C++ 等)都有一种与其相互转换的方法。
-前谷歌工程师。
http://code.google.com/apis/protocolbuffers/docs/reference/java/com/google/protobuf/TextFormat.html
It's true that in production/performance code you should only be dealing with binary form protocol buffers, but for debugging or convenience there is a well defined human readable format, and all of the interfaces (python, java, C++, etc.) have a means of translating into and out of it.
-former Google engineer.