Here you can find the source of delete(File file)
Parameter | Description |
---|---|
file | The file to delete |
Parameter | Description |
---|---|
IOException | if file is not null, exists but deletefails. |
public static void delete(File file) throws IOException
//package com.java2s; //License from project: BSD License import java.io.File; import java.io.IOException; public class Main { /**//from ww w. ja v a2 s. co m * Delete a file. Unlinke {@link File#delete()}, this throws an * exception if deletion fails. * @param file The file to delete * @throws IOException if file is not null, exists but delete * fails. */ public static void delete(File file) throws IOException { if (file == null || !file.exists()) return; if (!file.delete()) throw new IOException("Unable to delete file " + file.getAbsolutePath()); } }