I'm trying to find the right protostuff APIs to do what protoc --decode_raw and protoc --decode do.
Essentially handling two cases:
1) When I don't have the proto, and only the raw protobuf msg.
eg protoc --decode_raw < rawmsg.bin
2) When I have the .proto(not the generated classes, neither the proto descriptor .desc)
eg protoc --decode some.pkg.name.Person $proto_file_path < rawmsg.bin
From a bit digging here and there the hints I've got is
For case 1) Using CodedInputStream write my own parser? parsing bytes by making informed guesses.
But this is just using the protobuff API, does protostuff simply this scenario?
For case 2) I found io.protostuff.parser.ProtoUtil which has the parseProto method, taking a File, which does parse all the messages I have in my .proto
Here after I tried looking for an API like,
parse(byte, Proto, String) : Message
taking in a byte array and the parsed .proto and name of the message that the byte array is, returning a Message which all the fields, submessages etc filled.
However I couldn't find it.