生成html(2)
程序员文章站
2022-05-26 23:43:21
...
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.StringWriter;
public class PublishFileWriter {
/**
* 写文件到磁盘 realpath 生成文件的位置 fileName 生成文件的文件名
*
* @param articlecolumn
* @param fileContent
* @throws IOException
* @preserve
*/
public void writeFile( StringWriter fileContent,String realpath ,String fileName)
throws IOException {
File file;
FileWriter fw;
String content = fileContent.toString();
file = new File(realpath + "/" + fileName);
fw = new FileWriter(file);
fw.write(content);
fileContent.close();
fw.close();
}
}