File file = new File(filePath);
if(!file.exists()){
boolean tempFlag = file.mkdirs();
if(!tempFlag){
log.error("文件夹"+filePath+"创建失败");
return;
}
}
file = new File(filePath,filename);
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream fos = new FileOutputStream(filePath+filename, flag);
OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
for (String temp : fileContent)
osw.write(temp + "\r\n");
osw.flush();
osw.close();
}
--------------------------------------分割线 --------------------------------------
--------------------------------------分割线 --------------------------------------