当前位置:编程学习 > wap >>

java.io.StreamCorruptedException: Wrong format

小弟使用socket向客户端发一个自定义对象,强制转换时出现java.io.StreamCorruptedException: Wrong format异常,不知如何解决
异常信息如下

10-23 02:20:58.687: W/System.err(1276): java.io.StreamCorruptedException: Wrong format: ac
10-23 02:20:58.689: W/System.err(1276):  at java.io.ObjectInputStream.corruptStream(ObjectInputStream.java:701)
10-23 02:20:58.689: W/System.err(1276):  at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:814)
10-23 02:20:58.689: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006)
10-23 02:20:58.689: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1963)
10-23 02:20:58.689: W/System.err(1276):  at com.wsst.utils.SocketUtil$1.run(SocketUtil.java:77)
10-23 02:20:58.689: W/System.err(1276):  at java.lang.Thread.run(Thread.java:856)
10-23 02:20:58.689: W/System.err(1276): java.io.StreamCorruptedException: Wrong format: ed
10-23 02:20:58.699: W/System.err(1276):  at java.io.ObjectInputStream.corruptStream(ObjectInputStream.java:701)
10-23 02:20:58.699: W/System.err(1276):  at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:814)
10-23 02:20:58.699: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006)
10-23 02:20:58.699: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1963)
10-23 02:20:58.709: W/System.err(1276):  at com.wsst.utils.SocketUtil$1.run(SocketUtil.java:77)
10-23 02:20:58.709: W/System.err(1276):  at java.lang.Thread.run(Thread.java:856)
10-23 02:20:58.709: W/System.err(1276): java.io.StreamCorruptedException: Wrong format: 0
10-23 02:20:58.709: W/System.err(1276):  at java.io.ObjectInputStream.corruptStream(ObjectInputStream.java:701)
10-23 02:20:58.709: W/System.err(1276):  at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:814)
10-23 02:20:58.709: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006)
10-23 02:20:58.709: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1963)
10-23 02:20:58.709: W/System.err(1276):  at com.wsst.utils.SocketUtil$1.run(SocketUtil.java:77)
10-23 02:20:58.709: W/System.err(1276):  at java.lang.Thread.run(Thread.java:856)
10-23 02:20:58.719: W/System.err(1276): java.io.StreamCorruptedException: Wrong format: 5
10-23 02:20:58.719: W/System.err(1276):  at java.io.ObjectInputStream.corruptStream(ObjectInputStream.java:701)
10-23 02:20:58.719: W/System.err(1276):  at java.io.ObjectInputStream.readNonPrimitiveContent(ObjectInputStream.java:814)
10-23 02:20:58.719: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:2006)
10-23 02:20:58.719: W/System.err(1276):  at java.io.ObjectInputStream.readObject(ObjectInputStream.java:1963)
10-23 02:20:58.719: W/System.err(1276):  at com.wsst.utils.SocketUtil$1.run(SocketUtil.java:77)
10-23 02:20:58.729: W/System.err(1276):  at java.lang.Thread.run(Thread.java:856)
--------------------编程问答-------------------- 对像序列化了没 --------------------编程问答--------------------
引用 1 楼 guoyoulei520 的回复:
对像序列化了没

实现Serializable类了
补充:移动开发 ,  Android
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,