It appears that MQMessage derives from DataInput and DataOutput. I am guessing that writeUTF is doing the same thing as in DataOutputStream
.
You can reference this Answer for help Why does DataOutputStream.writeUTF() add additional 2 bytes at the beginning?
You have a few options:
inputMessage.write(message.getBytes("UTF-8"));
or probably
inputMessage.writeString(message);