/** * Tries to delete all files and folders under the temporary folder and * returns whether deletion was successful or not. * * @return {@code true} if all resources are deleted successfully, * {@code false} otherwise. */ private boolean tryDelete() { if (folder == null) { return true; } return recursiveDelete(folder); }
/** * Delete all files and folders under the temporary folder. Usually not * called directly, since it is automatically applied by the {@link Rule} */ public void delete() { if (folder != null) { recursiveDelete(folder); } }
private void recursiveDelete(File file) { File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } file.delete(); } }
private boolean recursiveDelete(File file) { // Try deleting file before assuming file is a directory // to prevent following symbolic links. if (file.delete()) { return true; } File[] files = file.listFiles(); if (files != null) { for (File each : files) { if (!recursiveDelete(each)) { return false; } } } return file.delete(); } }
/** * Delete all files and folders under the temporary folder. Usually not * called directly, since it is automatically applied by the {@link Rule} */ public void delete() { if (folder != null) { recursiveDelete(folder); } }
private void recursiveDelete(File file) { File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } file.delete(); } }
/** * Delete all files and folders under the temporary folder. Usually not * called directly, since it is automatically applied by the {@link Rule} */ public void delete() { if (folder != null) { recursiveDelete(folder); } }
/** * Delete all files and folders under the temporary folder. Usually not * called directly, since it is automatically applied by the {@link Rule} */ public void delete() { if (folder != null) { recursiveDelete(folder); } }
/** * Delete all files and folders under the temporary folder. Usually not * called directly, since it is automatically applied by the {@link Rule} */ public void delete() { if (folder != null) { recursiveDelete(folder); } }
/** * Delete all files and folders under the temporary folder. Usually not * called directly, since it is automatically applied by the {@link Rule} */ public void delete() { if (folder != null) { recursiveDelete(folder); } }
private void recursiveDelete(File file) { File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } file.delete(); } }
private void recursiveDelete(File file) { File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } file.delete(); } }
private void recursiveDelete(File file) { File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } file.delete(); } }
private void recursiveDelete(File file) { File[] files = file.listFiles(); if (files != null) { for (File each : files) { recursiveDelete(each); } } file.delete(); } }