本文共 712 字,大约阅读时间需要 2 分钟。
import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;public class CopyText { public static void main(String arg[]) { if(arg.length != 2) { System.out.println("Usage: java CopyText"); return; } try { int value; FileReader in = new FileReader(arg[0]); FileWriter out = new FileWriter(arg[1]); while((value = in.read()) != -1) out.write(value); in.close(); out.close(); } catch(IOException e) { System.out.println(e); } }}本文转自gnuhpc博客园博客,原文链接:http://www.cnblogs.com/gnuhpc/archive/2012/12/17/2822306.html,如需转载请自行联系原作者