I need to write multiple protobuf messages in a file.
I saw the post about the writeDelimitedFrom and parseDelimitedFrom in C++ and was wondering if it's better to use it (or something like it, another style of delimitations) or make a "super message" only containing the message I need to multiply write as a repeated attribute.
syntax = "proto2";
package test;
message myMessage {
required int32 TimeStamp = 1;
}
message Container {
repeated myMessage messages = 1;
}
Is it more interesting to write multiple myMessage
in a file with read/write DelimitedFrom or one Container
with repeated messages
?
I think using read/write DelimitedFrom is more optimized (as I can append only the last message) but using repeated attribute is easier but to SerializeToOstream
I think I must pass the whole Container
.
I don't think it's possible to serialize only a part of message to append it to the output file as I never saw it, but I can be wrong