On Oct 27, 2010, at 11:36 , Jimm wrote:
How are you parsing arbitrary PB bytes into a Generated Message ? I am
finding no class in API that can deserialize PB byte buffer into GeneratedMessage?

I'm using the generic Service API that is included with protocol buffers, so I'm not using GeneratedMessage. Rather, I'm using a message instance itself. The "register" does something ilke this:

serviceRegister.registerCall(MyCustomMessage.getDefaultInstance());


Then you can parse this with code like the following:

Message requestPrototype = ...; // stored in registerCall implementation
Message.Builder builder = requestPrototype.newBuilderForType();
builder.mergeFrom(requestByteString);


My code is actually available in the following hg repository. I don't recommend that people use it directly, since it is a bit hacky, but it could serve as an example:

http://people.csail.mit.edu/evanj/hg/index.cgi/javatxn/file/tip/src/ca/evanjones/protorpc/ServiceRegistry.java
http://people.csail.mit.edu/evanj/hg/index.cgi/javatxn/file/tip/src/ca/evanjones/protorpc/ProtoMethodInvoker.java


Good luck,

Evan

--
Evan Jones
http://evanjones.ca/

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