做个笔记下次直接拿来用
/**
* 根据文件路径删除文件
* @param filePath
* @return
*/
private static boolean deleteFile(String filePath) {
File curFile = new File(filePath);
if(!curFile.exists()) {
return true;
}
int i = 0;
for(; i<20 && !curFile.delete(); i++) {
try {
System.gc();
Thread.sleep(50);
}
catch (InterruptedException e) {}
}
return i<20;
}