本文整理汇总了Java中com.nostra13.universalimageloader.cache.disc.DiskCache类的典型用法代码示例。如果您正苦于以下问题:Java DiskCache类的具体用法?Java DiskCache怎么用?Java DiskCache使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DiskCache类属于com.nostra13.universalimageloader.cache.disc包,在下文中一共展示了DiskCache类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDiskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
/**
* Creates default implementation of {@link DiskCache} depends on incoming parameters
*/
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
long diskCacheSize, int diskCacheFileCount) {
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
try {
return new LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
diskCacheFileCount);
} catch (IOException e) {
L.e(e);
// continue and create unlimited cache
}
}
File cacheDir = StorageUtils.getCacheDirectory(context);
return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
示例2: createDiskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
/**
* Creates default implementation of {@link DiskCache} depends on incoming parameters
*/
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
long diskCacheSize, int diskCacheFileCount) {
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
try {
return new LruDiscCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
diskCacheFileCount);
} catch (IOException e) {
L.e(e);
// continue and create unlimited cache
}
}
File cacheDir = StorageUtils.getCacheDirectory(context);
return new UnlimitedDiscCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
示例3: createDiskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
/**
* 默认图片 本地路径缓存
* Creates default implementation of {@link DiskCache} depends on incoming parameters
*/
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
long diskCacheSize, int diskCacheFileCount) {
//创建备用缓存文件
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
try {
//创建本地文件系统缓存器
return new LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
diskCacheFileCount);
} catch (IOException e) {
L.e(e);
// continue and create unlimited cache
}
}
//创建无限制的文件缓存器
File cacheDir = StorageUtils.getCacheDirectory(context);
return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
开发者ID:jiangqqlmj,项目名称:Android-Universal-Image-Loader-Modify,代码行数:24,代码来源:DefaultConfigurationFactory.java
示例4: createDiskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator, long diskCacheSize, int diskCacheFileCount) {
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
try {
return new LruDiscCache(StorageUtils.getIndividualCacheDirectory(context), reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize, diskCacheFileCount);
} catch (IOException e) {
L.e(e);
}
}
return new UnlimitedDiscCache(StorageUtils.getCacheDirectory(context), reserveCacheDir, diskCacheFileNameGenerator);
}
示例5: createDiskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public static DiskCache createDiskCache(Context context, FileNameGenerator
diskCacheFileNameGenerator, long diskCacheSize, int diskCacheFileCount) {
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
try {
return new LruDiskCache(StorageUtils.getIndividualCacheDirectory(context),
reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
diskCacheFileCount);
} catch (IOException e) {
L.e(e);
}
}
return new UnlimitedDiskCache(StorageUtils.getCacheDirectory(context), reserveCacheDir,
diskCacheFileNameGenerator);
}
示例6: onRemove
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
/**
*/
@Override
protected boolean onRemove(@NonNull com.nostra13.universalimageloader.core.ImageLoader loader) {
ensureHasTargetOrThrow();
final MemoryCache memoryCache = loader.getMemoryCache();
final boolean removedFromMemory = memoryCache != null && memoryCache.remove(mTarget) != null;
final DiskCache diskCache = loader.getDiskCache();
final boolean removedFromDisk = diskCache != null && diskCache.remove(mTarget);
return removedFromMemory || removedFromDisk;
}
示例7: createDiskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
/**
* Creates default implementation of {@link DiskCache} depends on incoming parameters
*/
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
long diskCacheSize, int diskCacheFileCount) {
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
LruDiscCache diskCache = new LruDiscCache(individualCacheDir, diskCacheFileNameGenerator, diskCacheSize,
diskCacheFileCount);
diskCache.setReserveCacheDir(reserveCacheDir);
return diskCache;
} else {
File cacheDir = StorageUtils.getCacheDirectory(context);
return new UnlimitedDiscCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
}
示例8: findInCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public static File findInCache(String s, DiskCache diskcache)
{
File file = diskcache.get(s);
if (file != null && file.exists())
{
return file;
} else
{
return null;
}
}
示例9: diskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public Builder diskCache(DiskCache diskcache)
{
if (t > 0L || u > 0)
{
L.w("diskCache(), diskCacheSize() and diskCacheFileCount calls overlap each other", new Object[0]);
}
if (x != null)
{
L.w("diskCache() and diskCacheFileNameGenerator() calls overlap each other", new Object[0]);
}
w = diskcache;
return this;
}
示例10: diskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public diskCacheSize diskCache(DiskCache diskcache)
{
if (t > 0L || u > 0)
{
L.w("diskCache(), diskCacheSize() and diskCacheFileCount calls overlap each other", new Object[0]);
}
if (x != null)
{
L.w("diskCache() and diskCacheFileNameGenerator() calls overlap each other", new Object[0]);
}
w = diskcache;
return this;
}
示例11: createDiskCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public static DiskCache createDiskCache(Context context, FileNameGenerator filenamegenerator, long l, int i)
{
File file = a(context);
if (l > 0L || i > 0)
{
LruDiscCache lrudisccache = new LruDiscCache(StorageUtils.getIndividualCacheDirectory(context), filenamegenerator, l, i);
lrudisccache.setReserveCacheDir(file);
return lrudisccache;
} else
{
return new UnlimitedDiscCache(StorageUtils.getCacheDirectory(context), file, filenamegenerator);
}
}
示例12: findInCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
/** Returns {@link File} of cached image or <b>null</b> if image was not cached in disk cache */
public static File findInCache(String imageUri, DiskCache diskCache) {
File image = diskCache.get(imageUri);
return image != null && image.exists() ? image : null;
}
示例13: discCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
/** @deprecated Use {@link #diskCache(com.nostra13.universalimageloader.cache.disc.DiskCache)} */
@Deprecated
public Builder discCache(DiskCache diskCache) {
return diskCache(diskCache);
}
示例14: findInCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public static File findInCache(String imageUri, DiskCache diskCache) {
File image = diskCache.get(imageUri);
return (image == null || !image.exists()) ? null : image;
}
示例15: removeFromCache
import com.nostra13.universalimageloader.cache.disc.DiskCache; //导入依赖的package包/类
public static boolean removeFromCache(String imageUri, DiskCache diskCache) {
File image = diskCache.get(imageUri);
return image != null && image.exists() && image.delete();
}