I have a follow-up question:

Will using *messageInstance.newBuilderForType().mergeFrom(input).build();*work
for a stream that contains trailing binary information?

I'm asking this question for the following reason: I'm using a very simple
example where my Message just contains a single String.  When I print the
serialized message with a value of "my_string", I get "<binary>my_string".
Now, when I see the stream coming in on the deserialization side, I get
"<binary>my_string<binary>"  The leading binary is the same as the original,
however the trailing binary is something new entirely.  The trailing binary
is probably being created by Hadoop.

Kenton, you have made it very clear that *
messageInstance.newBuilderForType().mergeFrom(input).build();* is the
correct approach.  What could possibly be going wrong if the stream I'm
trying to deserialize from contains trailing binary data?

Thanks ahead of time for your help.


On Tue, Sep 9, 2008 at 10:47 AM, Alex Loddengaard <[EMAIL PROTECTED]
> wrote:

> After taking my code out of Hadoop, it looks as though my deserializing
> mechanism is working fine.  My problem lies with my integration with Hadoop.
> Thanks for resolving this issue, Kenton!
> Alex
> On Tue, Sep 9, 2008 at 9:42 AM, Alex Loddengaard <
>> On Tue, Sep 9, 2008 at 9:28 AM, Kenton Varda <[EMAIL PROTECTED]> wrote:
>>> To clarify:  In my original message I was saying that you should call
>>> isInitialized() on the builder returned by mergeFrom(), to make sure the
>>> parsed message is complete, before you call build().
>> Ah.  Now isInitialized() is returning true, though I'm still having
>> problems deserializing.  Now that I'm using OutputStream and InputStream,
>> I'm getting the following exception:
>> com.google.protobuf.InvalidProtocolBufferException: Protocol message tag
>> had invalid wire type.
>> I'm going to take my code out of Hadoop to see if Hadoop is causing these
>> issues.  I'm still weary of that, though, because other serialization
>> frameworks such as Facebook's Thrift seem to work in the framework that I am
>> using.
>> Thanks for your help, Kenton!  I'll check back soon with my progress.

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 

Reply via email to