+ }\r
+ \r
+ public static void string2file(String content, String filename) throws Exception {\r
+ ensureDir(filename);\r
+ PrintWriter outfile = new PrintWriter(new BufferedWriter(new FileWriter(filename)));\r
+ outfile.append(content);\r
+ outfile.flush();\r
+ outfile.close();\r
+ }\r
+ \r
+ public static HashSet<String> dirScan(String path) { // use HashSet, persue speed rather than space\r
+ HashSet<String> filelist = new HashSet<String>();\r
+ String[] list = new File(path).list();\r
+ File test;\r
+\r
+ for (int i = 0 ; i < list.length ; i++) {\r
+ test = new File(path + File.separator + list[i]);\r
+ if (test.isDirectory()) {\r
+ dirScan(path + File.separator + list[i]);\r
+ } else {\r
+ filelist.add(path + File.separator + list[i]);\r
+ }\r
+ }\r