IO流的复制
作者:互联网
1 public static void main(String[] args) throws Exception { 2 // 1:输入流 3 FileInputStream fis = new FileInputStream("1.png"); 4 // 2:输出流 5 FileOutputStream fos = new FileOutputStream("1copy.png"); 6 // 实现复制 7 byte[] buf = new byte[1024]; 8 int count=0; 9 while ((count=fis.read(buf)) != -1){ 10 System.out.println(count); 11 fos.write(buf,0,count); 12 } 13 14 // 关闭流 15 fis.close(); 16 fos.close(); 17 System.out.println("处理完毕"); 18 19 }
标签:count,fis,fos,System,复制,IO,new,buf 来源: https://www.cnblogs.com/xianzaikaishi/p/16366399.html