Open GoogleCodeExporter opened 9 years ago
I think the current implementation is working as expected. The problem you
described is the result of not closing the file properly (where flush() will be
called on the ostream) after writing. In the test you added in the attached
patch, close() should be called before reopening the file for reading.
Original comment by xiaof...@google.com
on 10 Jan 2014 at 12:19
I mostly agree and don't think it's a big deal either way. In my usage, the
ostream was getting closed much later, hence I ran into the issue. However, I
still think it will be good if OstreamOutputStream, on its exit path, commits
its writes to the ostream by means of a flush.
Thanks,
Abhishek Rai
Original comment by abhishek...@gmail.com
on 10 Jan 2014 at 12:36
Only the owner of the ostream knows when is the most appropriate time to call
flush() and apparently OstreamOutputStream doesn't own the underlying ostream
so it's not its responsibility to flush the stream.
Imaging the case where you need to serialize a lot of messages into the same
file, would you like to have every proto.SerializeToOstream(out) call flush the
out stream?
Original comment by xiaof...@google.com
on 10 Jan 2014 at 12:49
Sounds good, thanks!
Thanks,
Abhishek Rai
Original comment by abhishek...@gmail.com
on 10 Jan 2014 at 1:03
Original issue reported on code.google.com by
abhishek...@gmail.com
on 2 Jan 2014 at 7:47Attachments: