[protobuf] Re: Regd: Resolving Wire type ambiguities

2009-11-16 Thread Kenton Varda
It sounds like you actually have the message class available, not just a serialized instance of the message. In that case, you can derive the original type by reading the generated code. If you only have a compiled copy of the class, you can derive the type from its descriptor -- use MessageType.

[protobuf] Re: Regd: Resolving Wire type ambiguities

2009-11-16 Thread Jason Hsueh
You can decode the protocol buffer with just wire type + tag number, but you won't know the original types without a proto definition. Everything would be treated as an unknown field. You could access these by iterating through the UnknownFieldSet, but again, you can't recover the original types.

[protobuf] Re: Regd: Resolving Wire type ambiguities

2009-11-14 Thread rahul prasad
Hi Marc, Thanks for the clarification. If the actual .proto was there, i would not have posted that question [?] at the first place. Anyways, to decode a protocol buffer, is it not enough to have just the wire type + tag number combination? (except of course, handling of the sub-messages-ness and

[protobuf] Re: Regd: Resolving Wire type ambiguities

2009-11-14 Thread Marc Gravell
If you treat it as a string (UTF8), you are likely to get garbage. If you treat it as a byte[], then you just get a BLOB - you don't lose anything, but you might not be showing some more detail that you could show. You could, however, check for likely-sub-message-ness - i.e. after getting the leng