I have buffer that encoded with protocol-buffer , I want to read the buffer and change some data and encode it again.
I saw that when I encode the buffer ( SerializeToString
) the binary data is not the same so the server that get that buffer can't decoded that .
import messages_pb2
with open('proto.bin','rb') as f:
buffer1 = f.read()
my_obj1 = messages_pb2.MyObj()
my_obj1.ParseFromString(buffer1)
buffer2 = my_obj1.SerializeToString()
When I look at the binary data I think that the order of the data is changed. Is there any way to SerializeToString
but the choose the order of data ?