/** * Checks if the given file needs to be refreshed, and, if file doesn't exist, also checks and created if all the folders structure. * Basically performs subsequent calls to {@link #isFileOlderThan(File, long)} and {@link #parentFolderExists(File, boolean)}. * * @param file file to check * @param time time to check * @return whether file needs to be refreshed ({@code time} is older than file creation time * @throws ContentProviderException if case folders cannot be created */ public static boolean isToBeRefreshed(File file, long time) throws ContentProviderException { if (isFileOlderThan(file, time)) { if (!parentFolderExists(file, true)) { throw new ContentProviderException("Failed to create parent directory for file: " + file); } return true; } return false; }