本文整理汇总了Java中com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator类的典型用法代码示例。如果您正苦于以下问题:Java FileNameGenerator类的具体用法?Java FileNameGenerator怎么用?Java FileNameGenerator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
FileNameGenerator类属于com.nostra13.universalimageloader.cache.disc.naming包,在下文中一共展示了FileNameGenerator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的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: LruDiscCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
public LruDiscCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator, long cacheMaxSize, int cacheMaxFileCount) throws IOException {
this.bufferSize = 32768;
this.compressFormat = DEFAULT_COMPRESS_FORMAT;
this.compressQuality = 100;
if (cacheDir == null) {
throw new IllegalArgumentException("cacheDir argument must be not null");
} else if (cacheMaxSize < 0) {
throw new IllegalArgumentException("cacheMaxSize argument must be positive number");
} else if (cacheMaxFileCount < 0) {
throw new IllegalArgumentException("cacheMaxFileCount argument must be positive number");
} else if (fileNameGenerator == null) {
throw new IllegalArgumentException("fileNameGenerator argument must be not null");
} else {
if (cacheMaxSize == 0) {
cacheMaxSize = Long.MAX_VALUE;
}
if (cacheMaxFileCount == 0) {
cacheMaxFileCount = Integer.MAX_VALUE;
}
this.reserveCacheDir = reserveCacheDir;
this.fileNameGenerator = fileNameGenerator;
initCache(cacheDir, reserveCacheDir, cacheMaxSize, cacheMaxFileCount);
}
}
示例3: LruDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
public LruDiskCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator,
long cacheMaxSize, int cacheMaxFileCount) throws IOException {
this.bufferSize = 32768;
this.compressFormat = DEFAULT_COMPRESS_FORMAT;
this.compressQuality = 100;
if (cacheDir == null) {
throw new IllegalArgumentException("cacheDir argument must be not null");
} else if (cacheMaxSize < 0) {
throw new IllegalArgumentException("cacheMaxSize argument must be positive number");
} else if (cacheMaxFileCount < 0) {
throw new IllegalArgumentException("cacheMaxFileCount argument must be positive " +
"number");
} else if (fileNameGenerator == null) {
throw new IllegalArgumentException("fileNameGenerator argument must be not null");
} else {
if (cacheMaxSize == 0) {
cacheMaxSize = Long.MAX_VALUE;
}
if (cacheMaxFileCount == 0) {
cacheMaxFileCount = ActivityChooserViewAdapter.MAX_ACTIVITY_COUNT_UNLIMITED;
}
this.reserveCacheDir = reserveCacheDir;
this.fileNameGenerator = fileNameGenerator;
initCache(cacheDir, reserveCacheDir, cacheMaxSize, cacheMaxFileCount);
}
}
示例4: createDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的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);
}
示例5: LruDiscCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
/**
* @param cacheDir Directory for file caching
* @param fileNameGenerator {@linkplain com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator
* Name generator} for cached files. Generated names must match the regex
* <strong>[a-z0-9_-]{1,64}</strong>
* @param cacheMaxSize Max cache size in bytes. <b>0</b> means cache size is unlimited.
* @param cacheMaxFileCount Max file count in cache. <b>0</b> means file count is unlimited.
*/
public LruDiscCache(File cacheDir, FileNameGenerator fileNameGenerator, long cacheMaxSize, int cacheMaxFileCount) {
if (cacheDir == null) {
throw new IllegalArgumentException("cacheDir" + ERROR_ARG_NULL);
}
if (cacheMaxSize < 0) {
throw new IllegalArgumentException("cacheMaxSize" + ERROR_ARG_NEGATIVE);
}
if (cacheMaxFileCount < 0) {
throw new IllegalArgumentException("cacheMaxFileCount" + ERROR_ARG_NEGATIVE);
}
if (fileNameGenerator == null) {
throw new IllegalArgumentException("fileNameGenerator" + ERROR_ARG_NULL);
}
if (cacheMaxSize == 0) {
cacheMaxSize = Long.MAX_VALUE;
}
if (cacheMaxFileCount == 0) {
cacheMaxFileCount = Integer.MAX_VALUE;
}
this.fileNameGenerator = fileNameGenerator;
initCache(cacheDir, reserveCacheDir, cacheMaxSize, cacheMaxFileCount);
}
示例6: BaseDiscCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
public BaseDiscCache(File file, File file1, FileNameGenerator filenamegenerator)
{
bufferSize = 32768;
compressFormat = DEFAULT_COMPRESS_FORMAT;
compressQuality = 100;
if (file == null)
{
throw new IllegalArgumentException("cacheDir argument must be not null");
}
if (filenamegenerator == null)
{
throw new IllegalArgumentException("fileNameGenerator argument must be not null");
} else
{
cacheDir = file;
reserveCacheDir = file1;
fileNameGenerator = filenamegenerator;
return;
}
}
示例7: createDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的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
示例8: BaseDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
/**
* @param cacheDir Directory for file caching
* @param reserveCacheDir null-ok; Reserve directory for file caching. It's used when the primary directory isn't available.
* @param fileNameGenerator {@linkplain com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator
* Name generator} for cached files
*/
public BaseDiskCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator) {
if (cacheDir == null) {
throw new IllegalArgumentException("cacheDir" + ERROR_ARG_NULL);
}
if (fileNameGenerator == null) {
throw new IllegalArgumentException("fileNameGenerator" + ERROR_ARG_NULL);
}
this.cacheDir = cacheDir;
this.reserveCacheDir = reserveCacheDir;
this.fileNameGenerator = fileNameGenerator;
}
示例9: LruDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
/**
* @param cacheDir Directory for file caching
* @param reserveCacheDir null-ok; Reserve directory for file caching. It's used when the primary directory isn't available.
* @param fileNameGenerator {@linkplain com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator
* Name generator} for cached files. Generated names must match the regex
* <strong>[a-z0-9_-]{1,64}</strong>
* @param cacheMaxSize Max cache size in bytes. <b>0</b> means cache size is unlimited.
* @param cacheMaxFileCount Max file count in cache. <b>0</b> means file count is unlimited.
* @throws IOException if cache can't be initialized (e.g. "No space left on device")
*/
public LruDiskCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator, long cacheMaxSize,
int cacheMaxFileCount) throws IOException {
if (cacheDir == null) {
throw new IllegalArgumentException("cacheDir" + ERROR_ARG_NULL);
}
if (cacheMaxSize < 0) {
throw new IllegalArgumentException("cacheMaxSize" + ERROR_ARG_NEGATIVE);
}
if (cacheMaxFileCount < 0) {
throw new IllegalArgumentException("cacheMaxFileCount" + ERROR_ARG_NEGATIVE);
}
if (fileNameGenerator == null) {
throw new IllegalArgumentException("fileNameGenerator" + ERROR_ARG_NULL);
}
if (cacheMaxSize == 0) {
cacheMaxSize = Long.MAX_VALUE;
}
if (cacheMaxFileCount == 0) {
cacheMaxFileCount = Integer.MAX_VALUE;
}
this.reserveCacheDir = reserveCacheDir;
this.fileNameGenerator = fileNameGenerator;
initCache(cacheDir, reserveCacheDir, cacheMaxSize, cacheMaxFileCount);
}
示例10: diskCacheFileNameGenerator
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
/**
* Sets name generator for files cached in disk cache.<br />
* Default value -
* {@link com.nostra13.universalimageloader.core.DefaultConfigurationFactory#createFileNameGenerator()
* DefaultConfigurationFactory.createFileNameGenerator()}
*/
public Builder diskCacheFileNameGenerator(FileNameGenerator fileNameGenerator) {
if (diskCache != null) {
L.w(WARNING_OVERLAP_DISK_CACHE_NAME_GENERATOR);
}
this.diskCacheFileNameGenerator = fileNameGenerator;
return this;
}
示例11: BaseDiscCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
public BaseDiscCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator) {
this.bufferSize = 32768;
this.compressFormat = DEFAULT_COMPRESS_FORMAT;
this.compressQuality = 100;
if (cacheDir == null) {
throw new IllegalArgumentException("cacheDir argument must be not null");
} else if (fileNameGenerator == null) {
throw new IllegalArgumentException("fileNameGenerator argument must be not null");
} else {
this.cacheDir = cacheDir;
this.reserveCacheDir = reserveCacheDir;
this.fileNameGenerator = fileNameGenerator;
}
}
示例12: diskCacheFileNameGenerator
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
public Builder diskCacheFileNameGenerator(FileNameGenerator fileNameGenerator) {
if (this.diskCache != null) {
L.w(WARNING_OVERLAP_DISK_CACHE_NAME_GENERATOR, new Object[0]);
}
this.diskCacheFileNameGenerator = fileNameGenerator;
return this;
}
示例13: createDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的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);
}
示例14: diskCacheFileNameGenerator
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
/**
* Sets name generator for files cached in disk cache.<br />
* Default value -
* {@link com.nostra13.universalimageloader.core.DefaultConfigurationFactory#createFileNameGenerator()
* DefaultConfigurationFactory.createFileNameGenerator()}
*/
public Builder diskCacheFileNameGenerator(FileNameGenerator fileNameGenerator) {
if (diskCache != null) {
L.w(WARNING_OVERLAP_DISK_CACHE_NAME_GENERATOR);
}
this.diskCacheFileNameGenerator = fileNameGenerator;
return this;
}
示例15: BaseDiskCache
import com.nostra13.universalimageloader.cache.disc.naming.FileNameGenerator; //导入依赖的package包/类
public BaseDiskCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator) {
this.bufferSize = 32768;
this.compressFormat = DEFAULT_COMPRESS_FORMAT;
this.compressQuality = 100;
if (cacheDir == null) {
throw new IllegalArgumentException("cacheDir argument must be not null");
} else if (fileNameGenerator == null) {
throw new IllegalArgumentException("fileNameGenerator argument must be not null");
} else {
this.cacheDir = cacheDir;
this.reserveCacheDir = reserveCacheDir;
this.fileNameGenerator = fileNameGenerator;
}
}