跟着老师打出现异常了,,怎么解决?
public static void main(String[] args)throws IOException { String file = "demo/dos.dat"; IOUtil.printHex(file); DataInputStream dis = new DataInputStream( new FileInputStream(file)); int i=dis.readInt();System.out.println(i); i=dis.readInt();System.out.println(i); long l=dis.readLong();System.out.println(l); double d=dis.readDouble();System.out.println(d); String s=dis.readUTF();System.out.println(s); dis.close(); }
readUTF那边有什么问题呢
怎么传不了图片啊
Exception in thread "main" java.io.EOFException
at java.io.DataInputStream.readFully(DataInputStream.java:197)
at java.io.DataInputStream.readUTF(DataInputStream.java:609)
at java.io.DataInputStream.readUTF(DataInputStream.java:564)
at com.imooc.io.DisDemo.main(DisDemo.java:20)
第20行就是上面的第10行