Open vagabond1-1983 opened 8 years ago
public class FileUtil { /* * 清空文件内容,文件不存在则创建新文件。会抛出IO异常 * @param filePath 文件绝对路径 / public static void cleanContent(String filePath) { File file = new File(filePath); if (file.exists()) { file.delete(); }
try { file.createNewFile(); } catch (IOException e) { throw new RuntimeException(e); } }
}
public class FileUtil { /* * 清空文件内容,文件不存在则创建新文件。会抛出IO异常 * @param filePath 文件绝对路径 / public static void cleanContent(String filePath) { File file = new File(filePath); if (file.exists()) { file.delete(); }
}