public final class FoxBaseCacheDiskUtils extends java.lang.Object implements FoxBaseCacheConstants
DAY, HOUR, MIN, SEC| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
clear()
Clear all of the cache.
|
android.graphics.Bitmap |
getBitmap(java.lang.String key)
Return the bitmap in cache.
|
android.graphics.Bitmap |
getBitmap(java.lang.String key,
android.graphics.Bitmap defaultValue)
Return the bitmap in cache.
|
byte[] |
getBytes(java.lang.String key)
Return the bytes in cache.
|
byte[] |
getBytes(java.lang.String key,
byte[] defaultValue)
Return the bytes in cache.
|
int |
getCacheCount()
Return the count of cache.
|
long |
getCacheSize()
Return the size of cache, in bytes.
|
android.graphics.drawable.Drawable |
getDrawable(java.lang.String key)
Return the drawable in cache.
|
android.graphics.drawable.Drawable |
getDrawable(java.lang.String key,
android.graphics.drawable.Drawable defaultValue)
Return the drawable in cache.
|
static FoxBaseCacheDiskUtils |
getInstance()
cache directory: /data/data/package/cache/cacheUtils
cache size: unlimited
cache count: unlimited
|
static FoxBaseCacheDiskUtils |
getInstance(java.io.File cacheDir)
Return the single
FoxBaseCacheDiskUtils instance. |
static FoxBaseCacheDiskUtils |
getInstance(java.io.File cacheDir,
long maxSize,
int maxCount)
Return the single
FoxBaseCacheDiskUtils instance. |
static FoxBaseCacheDiskUtils |
getInstance(long maxSize,
int maxCount)
Return the single
FoxBaseCacheDiskUtils instance. |
static FoxBaseCacheDiskUtils |
getInstance(java.lang.String cacheName)
Return the single
FoxBaseCacheDiskUtils instance. |
static FoxBaseCacheDiskUtils |
getInstance(java.lang.String cacheName,
long maxSize,
int maxCount)
Return the single
FoxBaseCacheDiskUtils instance. |
org.json.JSONArray |
getJSONArray(java.lang.String key)
Return the JSONArray in cache.
|
org.json.JSONArray |
getJSONArray(java.lang.String key,
org.json.JSONArray defaultValue)
Return the JSONArray in cache.
|
org.json.JSONObject |
getJSONObject(java.lang.String key)
Return the JSONObject in cache.
|
org.json.JSONObject |
getJSONObject(java.lang.String key,
org.json.JSONObject defaultValue)
Return the JSONObject in cache.
|
<T> T |
getParcelable(java.lang.String key,
android.os.Parcelable.Creator<T> creator)
Return the parcelable in cache.
|
<T> T |
getParcelable(java.lang.String key,
android.os.Parcelable.Creator<T> creator,
T defaultValue)
Return the parcelable in cache.
|
java.lang.Object |
getSerializable(java.lang.String key)
Return the serializable in cache.
|
java.lang.Object |
getSerializable(java.lang.String key,
java.lang.Object defaultValue)
Return the serializable in cache.
|
java.lang.String |
getString(java.lang.String key)
Return the string value in cache.
|
java.lang.String |
getString(java.lang.String key,
java.lang.String defaultValue)
Return the string value in cache.
|
void |
put(java.lang.String key,
android.graphics.Bitmap value)
Put bitmap in cache.
|
void |
put(java.lang.String key,
android.graphics.Bitmap value,
int saveTime)
Put bitmap in cache.
|
void |
put(java.lang.String key,
byte[] value)
Put bytes in cache.
|
void |
put(java.lang.String key,
byte[] value,
int saveTime)
Put bytes in cache.
|
void |
put(java.lang.String key,
android.graphics.drawable.Drawable value)
Put drawable in cache.
|
void |
put(java.lang.String key,
android.graphics.drawable.Drawable value,
int saveTime)
Put drawable in cache.
|
void |
put(java.lang.String key,
org.json.JSONArray value)
Put JSONArray in cache.
|
void |
put(java.lang.String key,
org.json.JSONArray value,
int saveTime)
Put JSONArray in cache.
|
void |
put(java.lang.String key,
org.json.JSONObject value)
Put JSONObject in cache.
|
void |
put(java.lang.String key,
org.json.JSONObject value,
int saveTime)
Put JSONObject in cache.
|
void |
put(java.lang.String key,
android.os.Parcelable value)
Put parcelable in cache.
|
void |
put(java.lang.String key,
android.os.Parcelable value,
int saveTime)
Put parcelable in cache.
|
void |
put(java.lang.String key,
java.io.Serializable value)
Put serializable in cache.
|
void |
put(java.lang.String key,
java.io.Serializable value,
int saveTime)
Put serializable in cache.
|
void |
put(java.lang.String key,
java.lang.String value)
Put string value in cache.
|
void |
put(java.lang.String key,
java.lang.String value,
int saveTime)
Put string value in cache.
|
boolean |
remove(java.lang.String key)
Remove the cache by key.
|
java.lang.String |
toString() |
public static FoxBaseCacheDiskUtils getInstance()
cache directory: /data/data/package/cache/cacheUtils
cache size: unlimited
cache count: unlimited
public static FoxBaseCacheDiskUtils getInstance(java.lang.String cacheName)
FoxBaseCacheDiskUtils instance.
cache directory: /data/data/package/cache/cacheUtils
cache size: unlimited
cache count: unlimited
cacheName - The name of cache.FoxBaseCacheDiskUtils instancepublic static FoxBaseCacheDiskUtils getInstance(long maxSize, int maxCount)
FoxBaseCacheDiskUtils instance.
cache directory: /data/data/package/cache/cacheUtils
maxSize - The max size of cache, in bytes.maxCount - The max count of cache.FoxBaseCacheDiskUtils instancepublic static FoxBaseCacheDiskUtils getInstance(java.lang.String cacheName, long maxSize, int maxCount)
FoxBaseCacheDiskUtils instance.
cache directory: /data/data/package/cache/cacheName
cacheName - The name of cache.maxSize - The max size of cache, in bytes.maxCount - The max count of cache.FoxBaseCacheDiskUtils instancepublic static FoxBaseCacheDiskUtils getInstance(java.io.File cacheDir)
cacheDir - The directory of cache.FoxBaseCacheDiskUtils instancepublic static FoxBaseCacheDiskUtils getInstance(java.io.File cacheDir, long maxSize, int maxCount)
FoxBaseCacheDiskUtils instance.cacheDir - The directory of cache.maxSize - The max size of cache, in bytes.maxCount - The max count of cache.FoxBaseCacheDiskUtils instancepublic java.lang.String toString()
toString 在类中 java.lang.Objectpublic void put(java.lang.String key,
byte[] value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
byte[] value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public byte[] getBytes(java.lang.String key)
key - The key of cache.public byte[] getBytes(java.lang.String key,
byte[] defaultValue)
key - The key of cache.defaultValue - The default value if the cache doesn't exist.public void put(java.lang.String key,
java.lang.String value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
java.lang.String value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public java.lang.String getString(java.lang.String key)
key - The key of cache.public java.lang.String getString(java.lang.String key,
java.lang.String defaultValue)
key - The key of cache.defaultValue - The default value if the cache doesn't exist.public void put(java.lang.String key,
org.json.JSONObject value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
org.json.JSONObject value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public org.json.JSONObject getJSONObject(java.lang.String key)
key - The key of cache.public org.json.JSONObject getJSONObject(java.lang.String key,
org.json.JSONObject defaultValue)
key - The key of cache.defaultValue - The default value if the cache doesn't exist.public void put(java.lang.String key,
org.json.JSONArray value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
org.json.JSONArray value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public org.json.JSONArray getJSONArray(java.lang.String key)
key - The key of cache.public org.json.JSONArray getJSONArray(java.lang.String key,
org.json.JSONArray defaultValue)
key - The key of cache.defaultValue - The default value if the cache doesn't exist.public void put(java.lang.String key,
android.graphics.Bitmap value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
android.graphics.Bitmap value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public android.graphics.Bitmap getBitmap(java.lang.String key)
key - The key of cache.public android.graphics.Bitmap getBitmap(java.lang.String key,
android.graphics.Bitmap defaultValue)
key - The key of cache.defaultValue - The default value if the cache doesn't exist.public void put(java.lang.String key,
android.graphics.drawable.Drawable value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
android.graphics.drawable.Drawable value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public android.graphics.drawable.Drawable getDrawable(java.lang.String key)
key - The key of cache.public android.graphics.drawable.Drawable getDrawable(java.lang.String key,
android.graphics.drawable.Drawable defaultValue)
key - The key of cache.defaultValue - The default value if the cache doesn't exist.public void put(java.lang.String key,
android.os.Parcelable value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
android.os.Parcelable value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public <T> T getParcelable(java.lang.String key,
android.os.Parcelable.Creator<T> creator)
T - The value type.key - The key of cache.creator - The creator.public <T> T getParcelable(java.lang.String key,
android.os.Parcelable.Creator<T> creator,
T defaultValue)
T - The value type.key - The key of cache.creator - The creator.defaultValue - The default value if the cache doesn't exist.public void put(java.lang.String key,
java.io.Serializable value)
key - The key of cache.value - The value of cache.public void put(java.lang.String key,
java.io.Serializable value,
int saveTime)
key - The key of cache.value - The value of cache.saveTime - The save time of cache, in seconds.public java.lang.Object getSerializable(java.lang.String key)
key - The key of cache.public java.lang.Object getSerializable(java.lang.String key,
java.lang.Object defaultValue)
key - The key of cache.defaultValue - The default value if the cache doesn't exist.public long getCacheSize()
public int getCacheCount()
public boolean remove(java.lang.String key)
key - The key of cache.true: successfalse: failpublic boolean clear()
true: successfalse: fail