Merge two messages into one file

2008-10-10 Thread [EMAIL PROTECTED]

I have some kind of requirement that I did not find answer from the
document.  May someone help me.

I have different message objects which are inherited from one parent.
I need to serialize the objects into one file.
Some kind of solutions like:
e.g.
 message Style {
optional int32 color = 3;
optional int32 size = 4;
}

message Text {
optional Style style = 3;
optional string context = 4;
 }

message Image {
optional Style style = 3;

optional int32 width = 4;
optional int32 height = 5;
optional bytes data = 6;
 }

My Group object includes Text objects and Image objects.  But the
position is not fixed.
e.g.Text.Image.Image...Text
and could be: Image.Text...Image...Text

Now I need to serialize the objects into one file, and seek for the
solution using protocol buffer.
Implement this in Java is quite easy, because I can use
DataInputStream and serialize the objects.
Thanks for any hints.

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



Re: Merge two messages into one file

2008-10-10 Thread Kenton Varda
Sorry, I'm not sure I understand the question.  What, exactly, is the main
problem you're having?

On Fri, Oct 10, 2008 at 3:11 AM, [EMAIL PROTECTED]
[EMAIL PROTECTED]wrote:


 I have some kind of requirement that I did not find answer from the
 document.  May someone help me.

 I have different message objects which are inherited from one parent.
 I need to serialize the objects into one file.
 Some kind of solutions like:
 e.g.
  message Style {
optional int32 color = 3;
optional int32 size = 4;
 }

 message Text {
optional Style style = 3;
optional string context = 4;
  }

 message Image {
optional Style style = 3;

optional int32 width = 4;
optional int32 height = 5;
optional bytes data = 6;
  }

 My Group object includes Text objects and Image objects.  But the
 position is not fixed.
 e.g.Text.Image.Image...Text
 and could be: Image.Text...Image...Text

 Now I need to serialize the objects into one file, and seek for the
 solution using protocol buffer.
 Implement this in Java is quite easy, because I can use
 DataInputStream and serialize the objects.
 Thanks for any hints.

 


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---