Hi-
We have a fixed-size buffer into which we are serializing a message (a
pretty large and convoluted message, with many optional sub-messages and
repeated fields, etc).
We have found that when the message size gets bigger than the buffer size,
SerializeToArray just fails to write anything - we lose the whole message.
We'd like to be able to write as much message as we can, and just give up on
some of the optional fields, or, more likely, to stop adding elements to
repeated fields, etc.
What is the best way to do this efficiently?  It seems that calling
ByteSize() all the time will cost us in performance.  Is there a way to
efficiently compute the space needing during our message-building phase?  Or
is there a way to serialize as we go using some of the append methods, and
then just stop appending when we reach the limit?  What I don't understand
is how to avoid re-appending the same parts of the message that we already
serialized?  Let's also assume that most of the places we are likely to "run
out of space" is while we are adding more and more elements to repeated
fields.
Thanks for any help.
--edan

--~--~---------~--~----~------------~-------~--~----~
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