Parse Google Protocol Buffers datagram without .proto file?

泪湿孤枕 提交于 2019-11-30 20:32:30

protoc --decode_raw < my_file

You need to take the following things into account when inspecting the output:

  • None of the field names are visible, just the tag numbers.
  • All varint-fields are shown as integers. This is ok for most types, but sint* will appear in the "zigzagged" format.
  • Doubles and floats will be shown as hex.
  • Bytes, string fields and submessages all appear the same, i.e. just a bunch of bytes.

If you want to decode the messages programmatically, you can write your own .proto file after you have figured out what the fields mean using the above method.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!