java StreamCorruptedException: invalid type code: 77040000, what the ObjectInputStream expects?

前端 未结 2 1741
野性不改
野性不改 2021-01-29 02:15

i\'m working on a network java code, and i can\'t seem to understand what are the prerequisites an ObjectInputStream needs to interpret bytes. Here is a part of the code :

2条回答
  •  悲&欢浪女
    2021-01-29 02:30

    Yes you are right, i was reading the ObjectInputStream$BlockDataInputStream.readBlockHeader implementation when i realized that it uses read() to get a byte. The fact read() returns an integer made me implement it to read 4 bytes... I should have read more thorougly the javadoc of InputStream.

    Thanks for your help !

提交回复
热议问题