Concatenating encoded protocol messages has the effect of merging them, with
the same semantics as the MergeFrom() method.  That is, repeated fields will
be concatenated, singular primitive fields will take the *last* value, and
singular embedded messages/groups will be merged.
In your case, your concatenated message would contain the value of "foo"
from the last message in your set, but the repeated MyData would be
concatenated.

On Wed, Apr 1, 2009 at 11:47 AM, le <lance.earw...@gmail.com> wrote:

>
> I'm currently using protocol buffers to serialize variable-rate real-
> time data.  Per requirements I must serialize this data and make it
> available every X seconds.  At the end of the day we are required to
> have a single file that contains all of the data.
>
> So, after searching this group I discovered a posting that said
> something to the effect of combing binary messages and decoding them,
> implying I could do what I want: combine binary messages.
>
> Essentially, say I have a collection of protocol buffers on disk:
> 0.dat, 1.dat, etc.  If I cat them to a single file does this violate
> anything in terms of the (de-)serialization process?
>
> This is what I am thinking:
>
> 1) Produce collection of binary proto files: 0.dat, 1.dat, ...
> 2) cat *.dat > fullday.dat
> 3) decode fullday.dat, using the _same_ existing code that de-
> serializes 0.dat, 1.dat, etc.
>
> I have tested this exact scenario on my own and all of my data appears
> to be present but I am looking for some sort of confirmation.
>
> FYI, the proto file has structure similar to this (if it matters):
>
> message Collection {
>  required string foo;
>  repeated MyData;
> }
> message MyData {
>  float bar;
> }
>
> ... where each instance of 0.dat, 1.dat contains a message type of
> Collection.
>
> Thanks!
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to