//写文件
public void writeFile(String filePath, String sets) throws IOException {
try{
String encoding = "UTF-8";//设置文件的编码!!
OutputStreamWriter outstream = new OutputStreamWriter(new FileOutputStream(filePath), encoding);
PrintWriter writer = new PrintWriter(outstream);
writer.write(sets);
writer.close();
}
catch(IOException e){
e.printStackTrace();
}
}