标签:style blog color io os ar 文件 div sp
public class Main { public static void main(String[] args) { BufferedReader br = null; BufferedWriter bw = null; int count = 0; int index = 1; String temp = ""; try { br = new BufferedReader(new FileReader(new File("F:\\result.txt"))); while((temp = br.readLine()) != null){ bw = new BufferedWriter(new FileWriter(new File("F:\\output"+(index++)+".txt"))); while(count < 100000){ bw.append(temp); bw.newLine(); count++; temp = br.readLine(); if(temp == null){ break; } } count = 0; bw.close(); } br.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } }
假设result.txt有200多万行。
标签:style blog color io os ar 文件 div sp
原文地址:http://www.cnblogs.com/shuada/p/3965838.html