@@6Q7[O4X~{S7{Y~~~D)6GD.jpg (7.72 KB, 下载次数: 66)
import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; public class Copy { public static void main(String[] args) throws IOException { BufferedReader br=new BufferedReader(new InputStreamReader(new FileInputStream("d:\\照片\\a.jpg"))); BufferedWriter bw=new BufferedWriter(new OutputStreamWriter(new FileOutputStream("d:\\b.jpg"))); String line=null; while((line=br.readLine())!=null){ bw.write(line); } bw.close(); br.close(); } } 为什么用InputStreamReader和OutputStreamWriter转换之后,复制图片总是不成功。 |
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |