On Mar 7, 2011, at 13:03 , ksamdev wrote:
Hmm, thanks for the advice. It may work fine. Nevertheless, I have to skip previously read messages in this case every time CodedInputStream is read.

Not true: Creating a CodedInputStream does not change the position in the underlying stream. Your code can easily look like:


while (still more messages to read) {
  CodedInputStream in(&input_stream);
  in.Read*
  ...
  msg.ParseFromCodedStream();
}


This creates and destroys the CodedInputStream for each message, which is efficient.


Unfortunately, reading does not work out after 2^31 bytes are read. Is there a way around?

You will need to destroy and re-create the CodedInputStream object. If you don't want to do it for each message, you need to at least do it occasionally.

Evan

--
http://evanjones.ca/

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