Deciding exactly where to draw the line for lite mode was hard -- different
users want different things.
There's two reasonable options here:

1) Read the entire istream to a string first, then call ParseFromString.
 Similarly, when writing, use SerializeToString() then write the entire
string to the ostream.

2) Go into the protobuf source and pull out
src/google/protobuf/io/zero_copy_stream_impl.*.  Find the classes for
reading from and writing to iostreams and copy them into your own project
code.  Then use ParseFromZeroCopyStream() and SerializeToZeroCopyStream()
with those classes.

Option (1) is simpler but (2) may be a little bit more efficient if your
messages are fairly large (probably around 100k or more).

On Thu, Aug 13, 2009 at 3:48 PM, Handyman <> wrote:

> Those serializers seem to have been taken out for the MessageLite
> implementation.  I'm migrating old code to the lite implementation --
> I just create a std::ifstream/std::ofstream and hand it off to Message
> in my old code.  Whats the best way to do this in the new code?  The
> CodedStream stuff looks on point but the docs seem to imply that I'm
> getting into deep internals by considering them.
> >

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to