java.io.StreamCorruptedException: invalid stream header: 54657374

java.io.StreamCorruptedException: invalid stream header: 54657374

Clearly you arent sending the data with ObjectOutputStream: you are just writing the bytes.

  • If you read with readObject() you must write with writeObject().
  • If you read with readUTF() you must write with writeUTF().
  • If you read with readXXX() you must write with writeXXX(), for most values of XXX.

You cant expect ObjectInputStream to automagically convert text into objects. The hexadecimal 54657374 is Test as text. You must be sending it directly as bytes.

java.io.StreamCorruptedException: invalid stream header: 54657374

Leave a Reply

Your email address will not be published.