|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.nostra13.universalimageloader.cache.disc.impl.ext.LruDiscCache
public class LruDiscCache
Disk cache based on "Least-Recently Used" principle. Adapter pattern, adapts
DiskLruCache
to
DiskCache
FileNameGenerator
Field Summary | |
---|---|
protected int |
bufferSize
|
protected com.nostra13.universalimageloader.cache.disc.impl.ext.DiskLruCache |
cache
|
protected android.graphics.Bitmap.CompressFormat |
compressFormat
|
protected int |
compressQuality
|
static int |
DEFAULT_BUFFER_SIZE
{@value |
static android.graphics.Bitmap.CompressFormat |
DEFAULT_COMPRESS_FORMAT
{@value |
static int |
DEFAULT_COMPRESS_QUALITY
{@value |
protected FileNameGenerator |
fileNameGenerator
|
Constructor Summary | |
---|---|
LruDiscCache(File cacheDir,
File reserveCacheDir,
FileNameGenerator fileNameGenerator,
long cacheMaxSize,
int cacheMaxFileCount)
|
|
LruDiscCache(File cacheDir,
FileNameGenerator fileNameGenerator,
long cacheMaxSize)
|
Method Summary | |
---|---|
void |
clear()
Clears disk cache. |
void |
close()
Closes disk cache, releases resources. |
File |
get(String imageUri)
Returns file of cached image |
File |
getDirectory()
Returns root directory of disk cache |
boolean |
remove(String imageUri)
Removes image file associated with incoming URI |
boolean |
save(String imageUri,
android.graphics.Bitmap bitmap)
Saves image bitmap in disk cache. |
boolean |
save(String imageUri,
InputStream imageStream,
IoUtils.CopyListener listener)
Saves image stream in disk cache. |
void |
setBufferSize(int bufferSize)
|
void |
setCompressFormat(android.graphics.Bitmap.CompressFormat compressFormat)
|
void |
setCompressQuality(int compressQuality)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUFFER_SIZE
public static final android.graphics.Bitmap.CompressFormat DEFAULT_COMPRESS_FORMAT
public static final int DEFAULT_COMPRESS_QUALITY
protected com.nostra13.universalimageloader.cache.disc.impl.ext.DiskLruCache cache
protected final FileNameGenerator fileNameGenerator
protected int bufferSize
protected android.graphics.Bitmap.CompressFormat compressFormat
protected int compressQuality
Constructor Detail |
---|
public LruDiscCache(File cacheDir, FileNameGenerator fileNameGenerator, long cacheMaxSize) throws IOException
cacheDir
- Directory for file cachingfileNameGenerator
- Name generator for cached files. Generated names must match the regex
[a-z0-9_-]{1,64}cacheMaxSize
- Max cache size in bytes. 0 means cache size is unlimited.
IOException
- if cache can't be initialized (e.g. "No space left on device")public LruDiscCache(File cacheDir, File reserveCacheDir, FileNameGenerator fileNameGenerator, long cacheMaxSize, int cacheMaxFileCount) throws IOException
cacheDir
- Directory for file cachingreserveCacheDir
- null-ok; Reserve directory for file caching. It's used when the primary directory isn't available.fileNameGenerator
- Name generator for cached files. Generated names must match the regex
[a-z0-9_-]{1,64}cacheMaxSize
- Max cache size in bytes. 0 means cache size is unlimited.cacheMaxFileCount
- Max file count in cache. 0 means file count is unlimited.
IOException
- if cache can't be initialized (e.g. "No space left on device")Method Detail |
---|
public File getDirectory()
DiscCacheAware
getDirectory
in interface DiscCacheAware
public File get(String imageUri)
DiscCacheAware
get
in interface DiscCacheAware
imageUri
- Original image URI
public boolean save(String imageUri, InputStream imageStream, IoUtils.CopyListener listener) throws IOException
DiscCacheAware
save
in interface DiscCacheAware
imageUri
- Original image URIimageStream
- Input stream of imagelistener
- Listener for saving progress, can be ignored if you don't use
progress listener in ImageLoader calls
IOException
public boolean save(String imageUri, android.graphics.Bitmap bitmap) throws IOException
DiscCacheAware
save
in interface DiscCacheAware
imageUri
- Original image URIbitmap
- Image bitmap
IOException
public boolean remove(String imageUri)
DiscCacheAware
remove
in interface DiscCacheAware
imageUri
- Image URI
public void close()
DiscCacheAware
close
in interface DiscCacheAware
public void clear()
DiscCacheAware
clear
in interface DiscCacheAware
public void setBufferSize(int bufferSize)
public void setCompressFormat(android.graphics.Bitmap.CompressFormat compressFormat)
public void setCompressQuality(int compressQuality)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |