thanks a lot! that's exactly the thing(delimited serialization) I have been looking for, though not supported by build-in fun in c++, which is great!
all the best,
Charlie
发自我的小米手机在 Adam Cozzette ,2016年9月27日 上午11:39写道:I see, if you're just writing length delimiters then the most common conventi
I see, if you're just writing length delimiters then the most common
convention is to write the size as a varint right in front of the message
itself. Then to read the message you just read the varint prefix first to
find out how many more bytes to read. In Java we have built-in support for
this (w
hi Adam,
many thanks for the clarification and for sure I will stick to fix-sized type. the whole story was:
- before I write a message to file, I have to write the length of the object first, so I can parse and reconstruct it in memory thru SerializeFromArray(char*, size).
- when I do it, I defin
Yes, in your case the serialized size will remain the same because you are
using simple fixed-size fields and always initializing them.
There are a few things to watch out for, though:
- If you use proto3 syntax, zero-valued fields will be omitted from the
serialized output because zero is the def
在 2016年9月26日星期一 UTC-4下午2:57:14,job4c...@gmail.com写道:
>
> Will Google Protocol Buffer ensure this? This is a very important I think.
>
Notes: My message only uses fixed32 and all fields are initialized(values
might vary)
Message test_msg
{
optional fixed32 field1 = 1;
optional fixed32 field2 =