Answer the question
In order to leave comments, you need to log in
JAVA,PROTOBUF - how to implement dynamic deserialization/serialization knowing the object's class name?
Good evening
I am very bad at JAVA, please do not kick much.
There is a Packet package class in it 2 messages (in, out), the first bytes contain the length of the package and the package identifier (through which I get the class name for the package from the config) then the body the data itself.
PROTOBUF has a parseFrom method to convert a byte array to an object.
Problem - the class for the object to refuse is through
- Class.forName("Packet.In")
- Class.forName("Packet$In")
At the moment I don't know the intricacies of these 2 variations
If someone has already encountered such a problem , I will be very grateful for possible solutions.
Perhaps I didn’t read something on the dock, but so far I can’t find a solution for dynamic data parsing.
Thanks to all.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question