美文网首页
JavaSE FileCharCopy

JavaSE FileCharCopy

作者: 23b57d72cde7 | 来源:发表于2018-04-16 19:20 被阅读0次
package com.sxt;

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

/**
 * 使用文件字符输入输出流实现文件的复制
 * 
 * @author Administrator
 *
 */
public class FileCharCopy {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("c:/abc.txt");
        FileWriter fw = new FileWriter("d:/abc/abc.txt");
        char[] c = new char[1024];
        while (fr.read(c) != -1) {
            fw.write(c);
        }
        fw.close();
        fr.close();
    }

}

相关文章

网友评论

      本文标题:JavaSE FileCharCopy

      本文链接:https://www.haomeiwen.com/subject/kjaekftx.html