package com.day17.IO;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class ArrayCopyStandard {

  public static void main(String[] args) throws IOException {
    FileInputStream fis=new FileInputStream("桌面背景.jpg");
    FileOutputStream fos=new FileOutputStream("桌面背景copy.jpg");
    byte[] arr=new byte[1024*8];//创建两个字节的数组
    int len;
    while((len=fis.read(arr))!=-1) {//这是两个两个字节的度,比原来的快一倍
      fos.write(arr,0,len);//从0索引处开始写,长度为len
    }
    fis.close();
    fos.close();
  }

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-09
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2021-12-22
相关资源
相似解决方案