Here you can find the source of emptyFile(String srcFilename)
public static void emptyFile(String srcFilename) throws IOException
//package com.java2s; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void emptyFile(String srcFilename) throws IOException { File srcFile = new File(srcFilename); if (!srcFile.exists()) { throw new FileNotFoundException("Cannot find the file: " + srcFile.getAbsolutePath()); }/*from ww w. java 2 s .c om*/ if (!srcFile.canWrite()) { throw new IOException("Cannot write the file: " + srcFile.getAbsolutePath()); } FileOutputStream outputStream = new FileOutputStream(srcFilename); outputStream.close(); } }