com.nostra13.universalimageloader.utils
Class StorageUtils

java.lang.Object
  extended by com.nostra13.universalimageloader.utils.StorageUtils

public final class StorageUtils
extends Object

Provides application storage paths

Since:
1.0.0
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)

Method Summary
static File getCacheDirectory(android.content.Context context)
          Returns application cache directory.
static File getCacheDirectory(android.content.Context context, boolean preferExternal)
          Returns application cache directory.
static File getIndividualCacheDirectory(android.content.Context context)
          Returns individual application cache directory (for only image caching from ImageLoader).
static File getOwnCacheDirectory(android.content.Context context, String cacheDir)
          Returns specified application cache directory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getCacheDirectory

public static File getCacheDirectory(android.content.Context context)
Returns application cache directory. Cache directory will be created on SD card ("/Android/data/[app_package_name]/cache") if card is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system.

Parameters:
context - Application context
Returns:
Cache directory.
NOTE: Can be null in some unpredictable cases (if SD card is unmounted and Context.getCacheDir() returns null).

getCacheDirectory

public static File getCacheDirectory(android.content.Context context,
                                     boolean preferExternal)
Returns application cache directory. Cache directory will be created on SD card ("/Android/data/[app_package_name]/cache") (if card is mounted and app has appropriate permission) or on device's file system depending incoming parameters.

Parameters:
context - Application context
preferExternal - Whether prefer external location for cache
Returns:
Cache directory.
NOTE: Can be null in some unpredictable cases (if SD card is unmounted and Context.getCacheDir() returns null).

getIndividualCacheDirectory

public static File getIndividualCacheDirectory(android.content.Context context)
Returns individual application cache directory (for only image caching from ImageLoader). Cache directory will be created on SD card ("/Android/data/[app_package_name]/cache/uil-images") if card is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system.

Parameters:
context - Application context
Returns:
Cache directory

getOwnCacheDirectory

public static File getOwnCacheDirectory(android.content.Context context,
                                        String cacheDir)
Returns specified application cache directory. Cache directory will be created on SD card by defined path if card is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system.

Parameters:
context - Application context
cacheDir - Cache directory path (e.g.: "AppCacheDir", "AppDir/cache/images")
Returns:
Cache directory


Copyright © 2011-2014. All Rights Reserved.