java字节流复制文件

时间:2021-05-03 12:33:00   收藏:0   阅读:0

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();
    }
}


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!