public class Redis {
public static List<String> list = new
ArrayList<String>();
public static Jedis jedis;
public static void main(String[] args) throws IOException {
Getlist();
jedis = new Jedis("localhost");
String
md5;
jedis.flushDB();
File file = new
File("E:/work/Parser/Trial/out/check2.txt");
BufferedWriter bw = new
BufferedWriter(new FileWriter(file));
for (String value : list) {
md5
= MD5.digest(value);
if (!jedis.exists(md5)) {
jedis.set(md5,
value);
bw.write(md5 + " " +
value);
bw.newLine();
}
}
bw.close();
System.out.print("finish!");
}
private static void Getlist() throws IOException {
String
line;
File file = new
File("E:/work/Parser/Trial/out/dir.list");
BufferedReader br = new
BufferedReader(new FileReader(file));
while ((line = br.readLine()) !=
null) {
list.add(line);
}
br.close();
}
}
原文:http://www.cnblogs.com/agileblog/p/3610562.html