Jason -do you mean any Java output stream type will work (as all Java
IO stream types ultimately use bytes), and that the byte stream
produced will have the bytes put in an accepted standard order by the
writeTo method?  In other words, using the writeTo method for *any*
Java output stream type will produce a series of bytes that will
*always* be able to be read using the C++ equivalent of parseFrom on
the C++ side?


On Dec 2, 1:20 pm, Jason Hsueh <[email protected]> wrote:
> Protocol buffers implement their own serialization routines: the
> writeTo(OutputStream output) method will write the binary format to the
> OutputStream. From a socket, just do:
>
> MyProtoBuf pb = new MyProtoBuf;
> ...
> pb.writeTo(socket.getOutputStream());
>
> On Wed, Dec 2, 2009 at 7:47 AM, Nigel Pickard <[email protected]>wrote:
>
> > OK, so far I like GPB.  However, I have a very simple question, but
> > one which I can't find an answer for:
>
> > I have created a test Java application that uses ObjectInputStream and
> > ObjectOutputStream over sockets.  No problems, it works! I use my GPB
> > class writeTo and parseFrom to send and reconstitute my GPB class
> > using the ObjectInput and Output Streams....
>
> > But: isn't GPB allowing for serialization using bytes?  Are Object I/O
> > Streams the best streams to use?  Should I be using something else
> > like Data I/O streams?  E.g. from JavaDocs, "An ObjectOutputStream
> > writes primitive data types and graphs of Java objects to an
> > OutputStream" -is there a better, more efficient I/O stream I should
> > be using?
>
> > My concern is that when it comes to attempting to open a socket to a C+
> > + app, I assume the correct I/O stream type should be used.
>
> > If anyone has a working example of best practice using Data I/O
> > streams or a recommended stream type, that would be extremely useful
> > for me (even better if someone has a simple Java to C++ using sockets
> > example).
>
> > Thanks.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "Protocol Buffers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<protobuf%[email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/protobuf?hl=en.
>
>

--

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to [email protected].
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