日期:2014-05-20 浏览次数:20824 次
import java.io.*; public class Api { public static void main(String[] args) throws Exception { File f = new File("D:\\test");// 目录 FileReader fr = null; BufferedReader br = null; File fwrite = new File("D:\\ALLCDR.TXT");// 文件 FileWriter fw = new FileWriter(fwrite);// 写文件流 File[] fall = f.listFiles(); for (int count = 0; count < fall.length; count++) { fr = new FileReader(fall[count]); br = new BufferedReader(fr); String str = br.readLine(); while (str != null) { System.out.println(str); fw.write(str + "\n"); fw.flush(); str = br.readLine(); } br.close(); fr.close(); } fw.close(); } }