kk求知者
2018-03-31 00:45
Exception in thread "main" java.io.EOFException at java.io.DataInputStream.readInt(DataInputStream.java:392) at java.io.ObjectInputStream$BlockDataInputStream.readInt(ObjectInputStream.java:3139) at java.io.ObjectInputStream.readInt(ObjectInputStream.java:1023) at com.imooc.Student.readObject(Student.java:51) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1058) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2136) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2027) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1535) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:422) at com.imooc.ObjSeriaDemo1.main(ObjSeriaDemo1.java:25)
EOFException
文件尾异常
很明显,你用readInt无法读出Int,反而读到了文件尾
嗯 我这里写错了 应该是readobject
文件传输基础——Java IO流
133754 学习 · 1030 问题
相似问题