// 字符串转文件("测试文件内容", new File("D:/test.txt"));
public void 字符串转文件(String text, File file) {
BufferedReader br = null;
BufferedWriter bw = null;
try {
br = new BufferedReader(new StringReader(text));
bw = new BufferedWriter(new FileWriter(file));
char[] buf = new char[1024 * 64]; //字符缓冲区
int len;
while ((len = br.read(buf)) != -1) {
bw.write(buf, 0, len);
}
bw.flush();
br.close();
bw.close();
} catch (IOException e) {
e.printStackTrace();
}
}