beanshell 通过java写数据到文件
2020-12-13 03:20
标签:通过 pat ack create dir puts finally exce tput beanshell 通过java写数据到文件 标签:通过 pat ack create dir puts finally exce tput 原文地址:https://www.cnblogs.com/linbo3168/p/11073387.htmlimport java.io.*;
String filePath = "/data/account.txt";
String conent = vars.get("account");
BufferedWriter out = null;
try {
File file = new File(filePath);
File fileParent = file.getParentFile();
if (!fileParent.exists()) {
fileParent.mkdirs();
}
file.createNewFile();
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file, true)));
out.write(conent + "\r\n");
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
上一篇:Asp.net中XML与DataSet、DataTable之间的转换
下一篇:Raphael.js API之Raphael.pathIntersection(),aphael.pathToRelative(),Set.clear(),Set.exclude(element)