1 import java.io.*; 2 3 /* 4 使用FileInputStream类实现将D盘a.jpg复制到E盘目录下 5 */ 6 public class Demo { 7 public static void main(String[] args) throws IOException { 8 InputStream in = new FileInputStream("D://a.jpg"); 9 OutputStream out = new FileOutputStream("E://a.jpg"); 10 int len = 0 ; 11 byte[] b = new byte[1024 * 10]; 12 while ((len = in.read(b)) != -1){ 13 out.write(len); 14 } 15 out.close(); 16 in.close(); 17 } 18 }
原文地址:https://www.cnblogs.com/wangjixue/p/12121515.html
时间: 2024-10-12 23:50:01