//创建路径名
String path = new SimpleDateFormat("yyyyMMdd").format(new Date());
//String dir="/home/jqgj/srvmgr/servers/gmceip3.7/logs/phoneLogs/"+path;
String dir="D:/home/jqgj/srvmgr/servers/gmceip3.7/logs/phoneLogs/"+path;
SimpleDateFormat format = new SimpleDateFormat("yyyyMMddHHmmss");
//创建文件名
String tpmc=dir+"/"+context.getLogin().getUser().getName()+"_"+format.format(new Date())+".txt";
byte[] b =clientLog.getLogData();
File ret = null;
BufferedOutputStream stream = null;
try {
//创建文件
ret=new File(dir);
if(!ret.exists()){
ret.mkdirs();
}
//创建文件
File filename = new File(tpmc);
if (!filename.exists()) {
filename.createNewFile();
}
FileOutputStream fstream = new FileOutputStream(filename);
stream = new BufferedOutputStream(fstream);
stream.write(b);
} catch (Exception e) {
e.printStackTrace();
} finally {
if (stream != null) {
try {
stream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}