reading binary data

47 views
Skip to first unread message

Sonny Diaz

unread,
May 13, 2019, 3:06:43 PM5/13/19
to Protocol Buffers
Hi,

May I use protocol buffers strictly for reading binary data? In other words, the sender/writer did not use protocol buffers. Or does protocol buffers inject some metadata into the binary? I ask because the "optional" option makes me thing there is metadata. And also, avro injects the protocol into the binary. I am fine with everything being "required".

Usually, we would parse this data with structs in C/C++. However, going forward we want to expose the protocol definition to non programmers. So as a protocol evolves, the non programmer user can just edit a text file. Which brings up another question. Can I make it so that once the proto file is edited, the user can just run double click a shell script and then the binary be updated? I think that is still a bit too much for a non programmer, but from what I am reading, a proto edit requires two compilations (protocol buffers and my program) correct? Avro seemed more of a fit in that respect, but I don't want any metadata required for reading.

Thanks

Adam Cozzette

unread,
May 13, 2019, 4:39:17 PM5/13/19
to Sonny Diaz, Protocol Buffers
Protobuf uses its own binary format, so it's unlikely that you would be able to use protobuf to parse some binary data written by another program that isn't using protobuf. The binary format doesn't really have much metadata, but it's mostly just a series of tag-value pairs (see here for more information).

You can definitely set things up to rebuild your binary using a shell script, and like you mentioned this would usually involve at least two steps: first calling protoc on your .proto files and then invoking the C++ compiler. Protobuf doesn't have any built-in support for that because this is really the responsibility of whichever build system you're using.

--
You received this message because you are subscribed to the Google Groups "Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to protobuf+u...@googlegroups.com.
To post to this group, send email to prot...@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
To view this discussion on the web visit https://groups.google.com/d/msgid/protobuf/9ffc5008-c5c8-4dc8-8744-30052b174f65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages