/** * Do not use. Use createTemporaryDirectory instead. * * Used by frameworks/base unit tests to clean up a temporary directory. * Deliberately ignores errors, on the assumption that test cleanup is only * supposed to be best-effort. * * @deprecated Use {@link #createTemporaryDirectory} instead. */ public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteContents(file); } file.delete(); } } }
/** * Do not use. Use createTemporaryDirectory instead. * * Used by frameworks/base unit tests to clean up a temporary directory. * Deliberately ignores errors, on the assumption that test cleanup is only * supposed to be best-effort. * * @deprecated Use {@link #createTemporaryDirectory} instead. */ public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteContents(file); } file.delete(); } } }
/** * Do not use. Use createTemporaryDirectory instead. * * Used by frameworks/base unit tests to clean up a temporary directory. * Deliberately ignores errors, on the assumption that test cleanup is only * supposed to be best-effort. * * @deprecated Use {@link #createTemporaryDirectory} instead. */ public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteContents(file); } file.delete(); } } }
/** * Do not use. Use createTemporaryDirectory instead. * * Used by frameworks/base unit tests to clean up a temporary directory. * Deliberately ignores errors, on the assumption that test cleanup is only * supposed to be best-effort. * * @deprecated Use {@link #createTemporaryDirectory} instead. */ public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteContents(file); } file.delete(); } } }
/** * Do not use. Use createTemporaryDirectory instead. * * Used by frameworks/base unit tests to clean up a temporary directory. * Deliberately ignores errors, on the assumption that test cleanup is only * supposed to be best-effort. * * @deprecated Use {@link #createTemporaryDirectory} instead. */ public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteContents(file); } file.delete(); } } }
/** * Do not use. Use createTemporaryDirectory instead. * * Used by frameworks/base unit tests to clean up a temporary directory. * Deliberately ignores errors, on the assumption that test cleanup is only * supposed to be best-effort. * * @deprecated Use {@link #createTemporaryDirectory} instead. */ public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteContents(file); } file.delete(); } } }
/** * Do not use. Use createTemporaryDirectory instead. * * Used by frameworks/base unit tests to clean up a temporary directory. * Deliberately ignores errors, on the assumption that test cleanup is only * supposed to be best-effort. * * @deprecated Use {@link #createTemporaryDirectory} instead. */ public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { deleteContents(file); } file.delete(); } } }
/** * Recursively delete everything in {@code dir}. */ // TODO: this should specify paths as Strings rather than as Files public static void deleteContents(File dir) throws IOException { File[] files = dir.listFiles(); if (files == null) { throw new IllegalArgumentException("not a directory: " + dir); } for (File file : files) { if (file.isDirectory()) { deleteContents(file); } if (!file.delete()) { throw new IOException("failed to delete file: " + file); } } } }