Yes, it gets encoded in the PB wire format. See Daniel's earlier message:
writeTo(OutputStream os) wraps the stream in a CodedOutputStream for you.

On Thu, Aug 19, 2010 at 2:43 AM, Prakash Rao <prakashrao1...@gmail.com>wrote:

> I'm not using plain java serialization. I'm using protomessage object
> and I'm directly reading/writing from/to inputstream/outputstream that
> i got from httpurlconnection. I want to know whether my data will be
> encoded as i'm using inputstream & outputstream without wrapping it in
> codedinputstream & codedoutputstream.
>
> MyProtoObject.writeTo(outputstream);
> MyProtoObject.parseFrom(inputstream);
>
> Here outputstream & inputstream are got from httpurlconnection and are
> not wrapped within codedinputstream & codedoutstream. I would like to
> know whether PB does data encoding here.
>
> Regards,
> Prakash
>
> On Aug 18, 11:59 pm, Jason Hsueh <jas...@google.com> wrote:
> > On Wed, Aug 18, 2010 at 6:57 AM, Prakash Rao <prakashrao1...@gmail.com
> >wrote:
> >
> > > Thanks for your response. I wanted to whether it's CodedInputStream &
> > > CodedOutputStream which does encoding of data in PB?.
> >
> > Yes, these classes handle the PB wire format.
> >
> > > Will data get
> > > encoded if I just use OutputStream & InputStream (without wrapping it
> > > in CodedOutputStream & CodedInputStream) while sending & receiving the
> > > same?
> >
> > Are you asking about using Java serialization, and using
> > writeObject/readObject on InputStream and OutputStream? Messages
> implement
> > Serializable, and override it so that the protobuf wire format is used.
> > CodedInput/OutputStream will be used to read and write that format.
> >
> >
> >
> >
> >
> > > Regards,
> > > Prakash
> >
> > > On Aug 17, 12:32 am, Daniel Wright <dwri...@google.com> wrote:
> > > > I'm not completely sure I understand your question, but if you're
> asking
> > > > about the difference between writeTo(OutputStream) and
> > > > writeTo(CodedOutputStream), they're the same -- writeTo(OutputStream)
> > > just
> > > > wraps the OutputStream in a CodedOutputStream and writes to that.
>  Here's
> > > > the code:
> >
> > > >   public void writeTo(final OutputStream output) throws IOException {
> > > >     final int bufferSize =
> >
> > > CodedOutputStream.computePreferredBufferSize(getSerializedSize());
> > > >     final CodedOutputStream codedOutput =
> > > >         CodedOutputStream.newInstance(output, bufferSize);
> > > >     writeTo(codedOutput);
> > > >     codedOutput.flush();
> > > >   }
> >
> > > > Most users can just use OutputStream and let the above wrapper take
> care
> > > of
> > > > things for you, unless you're writing lots of tiny messages and the
> cost
> > > of
> > > > creating the CodedOutputStream becomes significant, or you're using
> the
> > > > CodedOutputStream to write your own metadata besides the message
> itself
> > > > (e.g. delimiters).
> >
> > > > On Mon, Aug 16, 2010 at 8:02 AM, Prakash Rao <
> prakashrao1...@gmail.com
> > > >wrote:
> >
> > > > > Hi,
> > > > > I'm new to PB and would like to know whether it is CodedInputStream
> &
> > > > > CodedOutputStream which takes care of encoding data while writing
> into
> > > > > streams. In few APIs I'm directly using InputStream & OutputStream
> > > > > taken from HTTP URL connection class and I would like to know if
> the
> > > > > data will be encoded in these cases (not using CodedInputStream &
> > > > > CodedOutputStream for these APIs). What other advantages
> > > > > CodedInputStream & CodedOutputStream will have as compared to
> direct
> > > > > InputStream & OutputStream taken from HTTP URL connection.
> >
> > > > > Regards,
> > > > > Prakash
> >
> > > > > --
> > > > > You received this message because you are subscribed to the Google
> > > Groups
> > > > > "Protocol Buffers" group.
> > > > > To post to this group, send email to proto...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to
> > > > > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> <protobuf%2bunsubscr...@googlegroups.c­om>
> > > <protobuf%2bunsubscr...@googlegroups.c­om>
> > > > > .
> > > > > For more options, visit this group at
> > > > >http://groups.google.com/group/protobuf?hl=en.-Hide quoted text -
> >
> > > > - Show quoted text -
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Protocol Buffers" group.
> > > To post to this group, send email to proto...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> <protobuf%2bunsubscr...@googlegroups.c­om>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/protobuf?hl=en.- Hide quoted text -
> >
> > - Show quoted text -
>
> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To post to this group, send email to proto...@googlegroups.com.
> To unsubscribe from this group, send email to
> protobuf+unsubscr...@googlegroups.com<protobuf%2bunsubscr...@googlegroups.com>
> .
> 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 proto...@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