@Test public void remove() throws IOException { assertFalse("'null' files are not deleted.", Files.remove(null)); assertFalse("Non existing files are not deleted.", Files.remove(new File( "/somethingThatDoesntExistsOnMostMachines-111111111111111111111111111111"))); File file = File.createTempFile("wicket-test--", ".tmp"); assertTrue("The just created file should exist!", file.isFile()); boolean removed = Files.remove(file); assertFalse("The just removed file should not exist!", file.exists()); assertTrue("Files.remove(file) should remove the file", removed); removed = Files.remove(file); assertFalse("The just removed file should not exist!", file.exists()); assertFalse("Files.remove(file) should not remove the file", removed); File folder = new File(System.getProperty("java.io.tmpdir"), "wicket-test-folder"); Files.mkdirs(folder); assertTrue(folder.isDirectory()); assertFalse("Should not be able to delete a folder, even empty one.", Files.remove(folder)); assertTrue("Should not be able to delete a folder.", Files.removeFolder(folder)); }
public static boolean remove(final File file) { if (file != null && file.isFile()) { for (int j = 0; j < 5; ++j) { for (int i = 0; i < 10; ++i) { if (file.delete()) { return true; } try { Thread.sleep(100); } catch (InterruptedException ix) { Thread.currentThread().interrupt(); } } } } return false; }
Files { public static boolean remove(final File file) { if (file != null && file.isFile()) { for (int j = 0; j < 5; ++j) { for (int i = 0; i < 10; ++i) { if (file.delete()) { return true; } try { Thread.sleep(100); } catch (InterruptedException ix) { Thread.currentThread().interrupt(); } } } } return false; } }
Files { public static boolean remove(final File file) { if (file != null && file.isFile()) { for (int j = 0; j < 5; ++j) { for (int i = 0; i < 10; ++i) { if (file.delete()) { return true; } try { Thread.sleep(100); } catch (InterruptedException ix) { Thread.currentThread().interrupt(); } } } } return false; } private  Files(); }
Files { public static boolean remove(final File file) { if (file != null && file.isFile()) { for (int j = 0; j < 5; ++j) { for (int i = 0; i < 10; ++i) { if (file.delete()) { return true; } try { Thread.sleep(100); } catch (InterruptedException ix) { Thread.currentThread().interrupt(); } } } } return false; } private  Files(); static String basePath(final String path, final String extension); static String extension(final String path); static String filename(final String path); static boolean remove(final File file); static final boolean removeFolder(final File folder); static final int writeTo(final File file, final InputStream input); static final int writeTo(final File file, final InputStream input,
                                    final int bufSize); static final String cleanupFilename(final String filename); static File getLocalFileFromUrl(URL url); static File getLocalFileFromUrl(String url); static Time getLastModified(File file); static boolean mkdirs(File folder); }
Files { public static boolean remove(final File file) { if (file != null && file.isFile()) { for (int j = 0; j < 5; ++j) { for (int i = 0; i < 10; ++i) { if (file.delete()) { return true; } try { Thread.sleep(100); } catch (InterruptedException ix) { Thread.currentThread().interrupt(); } } } } return false; } private  Files(); static String basePath(final String path, final String extension); static String extension(final String path); static String filename(final String path); static boolean remove(final File file); static final boolean removeFolder(final File folder); static final int writeTo(final File file, final InputStream input); static final int writeTo(final File file, final InputStream input,
                                    final int bufSize); static final String cleanupFilename(final String filename); static File getLocalFileFromUrl(URL url); static File getLocalFileFromUrl(String url); static Time getLastModified(File file); static boolean mkdirs(File folder);  }