Mercurial Hosting > luan
comparison src/goodjava/io/IoUtils.java @ 1475:c7b86342857f
more IoUtils
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sat, 18 Apr 2020 11:02:18 -0600 |
parents | 6c6ce14db6a8 |
children | af55cfad6e12 |
comparison
equal
deleted
inserted
replaced
1474:13cbce740e1e | 1475:c7b86342857f |
---|---|
13 } | 13 } |
14 | 14 |
15 public static void delete(File file) throws IOException { | 15 public static void delete(File file) throws IOException { |
16 Files.deleteIfExists( file.toPath() ); | 16 Files.deleteIfExists( file.toPath() ); |
17 } | 17 } |
18 | |
19 public static boolean isSymbolicLink(File file) { | |
20 return Files.isSymbolicLink(file.toPath()); | |
21 } | |
22 | |
23 public static void deleteRecursively(File file) throws IOException { | |
24 if( file.isDirectory() && !isSymbolicLink(file) ) { | |
25 for( File f : file.listFiles() ) { | |
26 deleteRecursively(f); | |
27 } | |
28 } | |
29 delete(file); | |
30 } | |
31 | |
18 } | 32 } |