I recently ran into this problem as well.  I wrote a socket stream
that has a flush operation.  To use it I had to do

{
  CodedOutputStream coded(&my_zero_copy_socket_stream);
  message.SerializeToCodedStream(&coded);
}
// coded is now out of scope so it has back-up unused buffer
my_zero_copy_socket_stream.Flush();

I had to use coded stream temporarily to write, then call Flush() on
the underlying stream AFTER it goes out of scope.  It feels a bit
ugly.

But then again, Flush() does not really make sense for many things,
and having its existence in the abstract interface clouds its meaning
(so you would have to say in ArrayOutputStream that Flush() does
nothing.

Frank


On Oct 20, 2:37 pm, ptab <[EMAIL PROTECTED]> wrote:
> Hello,
>
> Why there is no Flush() operation on ZeroCopyOutputStream and on
> CodedOutputStream? Is there any way to persist/send over network
> whole current content of buffers ?
> I think I would be able to provide implementation of the method for
> most stream's implementations, but I think that it was a design
> decision.
> What's the reason ?
>
> I would like to implemented some communication over network based on
> these
> streams and flush operation is crucial to avoid blocking on both ends
> of the protocol.
>
> Thanks,
> Piotr Tabor
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to