public static void delete ( File file ) throws IOException { Params . notNull ( file , "File" ) ; if ( file . exists ( ) && ! file . delete ( ) ) { throw new IOException ( Strings . format ( "Fail to delete file |%s|." , file ) ) ; } }
Delete file if exists throwing exception if delete fails . Note that this method does nothing if file does not exist ; anyway null parameter sanity check is still performed .