Having multiple proto files with multiple messages within each. 

Standing with a String read from a Socket. My processor class gets a String 
from a socket connection. 
This String I need to convert to a Message and forward it to a listener.

I need to create a message withouth knowing which message I have.

Must be a better way than this?
String text;
byte[] data = text.getBytes();

Message message = null;
try {
   message = Systems.Foo.parseFrom(data);
} catch (InvalidProtocolBufferException e) {


try {
    message = Systems.Bar.parseFrom(data);
} catch (InvalidProtocolBufferException e) {


try {
    message = Users.Logon.parseFrom(data);
} catch (InvalidProtocolBufferException e) {


return message;

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 protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at http://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to