vagabond1-1983 / blog

My tech blog for achieve
GNU General Public License v2.0
2 stars 0 forks source link

FileUtil #44

Open vagabond1-1983 opened 8 years ago

vagabond1-1983 commented 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);
    }
}

}