123456789101112131415161718192021 |
- package com.cdf.util;
- import java.io.*;
- public class FileUtils {
- public static void writeFile(String filePath, String str) throws IOException {
- File fout = new File(filePath);
- if (!fout.getParentFile().exists()) {
- fout.getParentFile().mkdirs();
- }
- if (!fout.exists()) {
- fout.createNewFile();
- }
- FileOutputStream fos = new FileOutputStream(fout);
- BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(fos));
- bw.write(str);
- bw.close();
- }
- }
|