[protobuf] Re: how to calculate protocol buffer message size without parsing the full message?

2013-04-22 Thread Oliver Wang
Can't you use ByteSize() method to get the size?

Oliver

On Sunday, April 21, 2013 12:07:57 AM UTC-4, Sean Nguyen wrote:

 Hi,

 I want to calculate the protocol buffer message size without reading the 
 stream to the end? I don't see the size of the outer most message is 
 stored. For example:

 message Person {
optional string name = 1; 
optional uint32 age = 2; 
 }

 There is no size store for the Person message if it is the outer most 
 message. Is that correct? If it is not where I can find it?

 Thanks,

 Son Nguyen


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




Re: [protobuf] Re: how to calculate protocol buffer message size without parsing the full message?

2013-04-22 Thread Oliver Jowett
On Sun, Apr 21, 2013 at 9:48 PM, Oliver Wang python...@gmail.com wrote:

 Can't you use ByteSize() method to get the size?


Not when you're parsing - you don't have a message instance yet!

Oliver

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