> I need a generic parser in java, which can de-serialize PB bytes
> buffer into a Message or GeneratedMessage. But, GeneratedMessage
> provides no such method to merge an arbitary PB bytes and provide an
> instance  of itself.

>From just a message's bytes you can't turn it into a Message.  The
serialized format doesn't include type information.

You've got a couple choices.  First, if you can send the message's
Descriptor along with the message, then you can use
DynamicMessage.parseFrom(Descriptor, byte[]) to deserialize it.  If
you can't send the message's Descriptor along, then you can use
UnknownFieldSet.parseFrom(byte[]), but that's not going to give you
very much at all, just tag numbers, their wiretype, and their value.

- Adam

-- 
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