I/O问题,求助……
本人新手,正在学习I/O:如能解答,感激不尽……
出现的问题如下:
java.io.IOException: Write error
at java.io.FileOutputStream.write(Native Method)
at test.WriteBytes.main(WriteBytes.java:17)
代码如下:
package test;
import java.io.*;
public class WriteBytes {
public static void main(String[] args){
int[] data={71,73,70,56,57,97,15,0,15,0,
128,0,0,255,255,255,0,0,0,44,0,0,0,
0,15,0,15,0,0,2,33,132,127,161,200,
185,205,84,128,241,81,35,175,155,26,
228,254,105,22,102,121,165,201,145,169,
154,142,172,116,162,240,90,197,5,0,59
};
try{
FileOutputStream file=new FileOutputStream("pic.gif ");
for(int i=0;i<data.length;i++){
file.write(data[i]);
file.close();
}
}catch(
IOException e){
e.printStackTrace();
System.out.println(e.toString());
}
}
}
------解决方案--------------------
Java code
file.close();
------解决方案--------------------
file.close();问题