【复制文本文件】

package test;

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

/**
 * @author shusheng
 * @description 复制文本文件
 * @Email shusheng@yiji.com
 * @date 2018/11/9 17:23
 */
public class CopyFileDemo1 {

    public static void main(String[] args) throws IOException {

        FileInputStream fis = new FileInputStream("fos.txt");
        FileOutputStream fos = new FileOutputStream("fis.txt");

        int by = 0;
        while((by=fis.read())!=-1){
            fos.write(by);
        }

        fis.close();
        fos.close();

    }

}

 

posted @ 2018-11-11 00:12  书丶生  阅读(195)  评论(0编辑  收藏  举报