JAVA 字符流复制Java文件改进版

package FileDemo.StringDemo;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;

public class Fcopy {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("stu\\src\\FileDemo\\StringDemo\\Demno1.java");
        FileWriter fw = new FileWriter("stu\\src\\FileDemo\\StringDemo\\11.java");

        char[] chs = new char[1024];
        int len;
        while ((len = fr.read(chs)) != -1){
            fw.write(chs,0,len);
        }
        fr.close();
        fw.close();
    }
}

猜你喜欢

转载自blog.csdn.net/qq_34608447/article/details/114858347
今日推荐