The serialized message does not contain any type information. You would either have to create a super-message for that, or have some other sort of knowledge of what type to expect. (A problem with the super-message approach is all the copying involved, so if that's a concern, you can just manually encode stuff into a CodedOutputStream.)
On Fri, Jul 4, 2014 at 11:33 AM, Andrew Klitovchenko <[email protected]> wrote: > Hi, > > I am writing an app that uses google protobuf to decode the serialized > messages which were coded using .proto definitions. > If I have the .proto file and during run time I have different types of > messages coming to my app. I wan to be able to identify which message it is > according to .proto definitions. > How can I do that? GetTypeName()? Or I cannot identify which message it is I > am reading during run time? > > Thanks, > Andrew > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
