MCPcopy Create free account
hub / github.com/0opslab/opslabJutil / cleanFile

Method cleanFile

src/main/java/com/opslab/util/FileUtil.java:289–299  ·  view source on GitHub ↗

快速清空一个超大的文件 @param file 需要处理的文件 @return 是否成功

(File file)

Source from the content-addressed store, hash-verified

287 * @return 是否成功
288 */
289 public final static boolean cleanFile(File file) {
290 try (
291 FileWriter fw = new FileWriter(file)
292 ) {
293 fw.write("");
294 return true;
295 } catch (IOException e) {
296 e.printStackTrace();
297 }
298 return false;
299 }
300
301 /**
302 * 获取文件的Mime类型

Callers 3

testCleanFileMethod · 0.95
testCleanFileMethod · 0.95
deleteBigFileMethod · 0.95

Calls 1

writeMethod · 0.45

Tested by 2

testCleanFileMethod · 0.76
testCleanFileMethod · 0.76