58 lines
1.6 KiB
Java
58 lines
1.6 KiB
Java
package com.tenwa.collectaudit.cache;
|
|
|
|
|
|
import java.io.File;
|
|
import java.io.FileWriter;
|
|
import java.io.IOException;
|
|
|
|
|
|
public class InterFaceFileCreate {
|
|
|
|
/**
|
|
* 生成送盘文件
|
|
*
|
|
* @param sendData
|
|
* @param fileSavePath
|
|
* @param fileName
|
|
*/
|
|
public static void sendDiscFileCreate(String sendData, String fileSavePath, String fileName) {
|
|
try {
|
|
File file = new File(fileSavePath);
|
|
if (!file.exists()) {//目录不存在则直接创建
|
|
file.mkdirs();
|
|
}
|
|
String filePath = file.getAbsolutePath();
|
|
FileWriter fileWriter = new FileWriter(filePath + "/" + fileName + ".txt");
|
|
String ss = sendData;
|
|
fileWriter.write(ss);
|
|
fileWriter.flush();
|
|
fileWriter.close();
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* 生成回盘文件
|
|
*
|
|
* @param replyData
|
|
* @param fileSavePath
|
|
* @param fileName
|
|
*/
|
|
public static void replyDiscFileCreate(String replyData, String fileSavePath, String fileName) {
|
|
try {
|
|
File file = new File(fileSavePath);
|
|
if (!file.exists()) {//目录不存在则直接创建
|
|
file.mkdirs();
|
|
}
|
|
String filePath = file.getAbsolutePath();
|
|
FileWriter fileWriter = new FileWriter(filePath + "/" + fileName + ".rnt");
|
|
String ss = replyData;
|
|
fileWriter.write(ss);
|
|
fileWriter.flush();
|
|
fileWriter.close();
|
|
} catch (IOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
} |