import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.ArrayList;

import java.util.List;


public class Test1 {
public static void main(String[] args)throws IOException{


String oldFile1="C:\\zlb\\110.txt";
String oldFile2="C:\\zlb\\123.txt";
String newFile="C:\\zlb\\222.txt";

List<String> list1 = new ArrayList<String>();
BufferedReader in1=new BufferedReader(new InputStreamReader( new FileInputStream(oldFile1), "utf-8"));
BufferedReader in2=new BufferedReader(new InputStreamReader( new FileInputStream(oldFile2), "utf-8"));
BufferedWriter ou=new BufferedWriter(new OutputStreamWriter(new FileOutputStream(newFile),"utf-8"));
String line1;
String temp;
String key;

while( (line1=in1.readLine())!=null){
list1.add(line1);

}

while((temp=in2.readLine())!=null){
boolean flag=true;
key=temp.split("=")[0];

for(int i=0;i<list1.size();i++){
if(key.equals(list1.get(i))){
flag=false;
break;
}

}

if(flag){

ou.write(temp);
ou.newLine();

}

}

in2.close();
ou.close();

}
}

posted on 2015-12-08 14:00  小飞虫子  阅读(228)  评论(0编辑  收藏  举报