java字节流复制文件


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

//字节流复制文件
public class FileInputStream2 {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("E:\\Workpace\\abc.txt");
        FileOutputStream fileOutputStream = new FileOutputStream("E:\\Workpace\\ccc.txt");
        int b;
        while((b = fileInputStream.read()) != -1){
            fileOutputStream.write(b);
        }
        fileInputStream.close();
        fileOutputStream.close();
    }
}


posted @ 2021-05-01 09:52  code-G  阅读(46)  评论(0编辑  收藏  举报