Re: [protobuf] How to serialize/deserialize bytes data?

2016-12-22 Thread Henner Zeller
On 22 December 2016 at 14:50, wrote: > Thanks for the reply. > > My question here is: I use protobuffer to store a bytes data, how can I > retrieve it back? Symmetric to the SerializeToArray(), use ParseFromArray() or ParseFromString() to parse a serialized version of a

Re: [protobuf] How to serialize/deserialize bytes data?

2016-12-22 Thread 'Adam Cozzette' via Protocol Buffers
It looks like you are building up a protocol buffer containing a serialized protocol buffer, which itself contains a serialized protocol buffer, which in turn contains a serialized protocol buffer, etc. Each level of nesting requires an additional two bytes: one byte for the tag number and a

[protobuf] How to serialize/deserialize bytes data?

2016-12-22 Thread song1219
I defined a simple bytes message below message MfStream { bytes message=1; } and run a test below, in which I use for a loop to keep serialize/deserialize the bytes message. char buf[1024]; int tmp = 1; MfStream testMsg; testMsg.set_message(, sizeof(tmp)); for (int i=0; i<5; i++) { int