复制文本文件

Posted zuixinxian

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了复制文本文件相关的知识,希望对你有一定的参考价值。

package test;

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

/**
 * @author shusheng
 * @description 复制文本文件
 * @Email [email protected]
 * @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();

    }

}

 

以上是关于复制文本文件的主要内容,如果未能解决你的问题,请参考以下文章