static void deleteContents(File dir) throws IOException {
    File[] files = dir.listFiles();
    if (files == null) {
      throw new IOException("not a readable directory: " + dir);
    }
    for (File file : files) {
      if (file.isDirectory()) {
        deleteContents(file);
      }
      if (!file.delete()) {
        throw new IOException("failed to delete file: " + file);
      }
    }
  }
Deletes the contents of {@code dir}. Throws an IOException if any file
could not be deleted, or if {@code dir} is not a readable directory.
core/src/main/java/com/bumptech/glide/disklrucache/Util.java