java.lang.Object | |
↳ | com.kinvey.android.offline.SQLiteFileCache |
File Caching allows your application to store files locally in an arbitrary location, and maintains metadata about the contents of the cache in sqlite table.
When saving a new file into the directory, an AsyncTask will be kicked off which will delete the oldest files until the cache size is under the threshold.Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | TAG |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SQLiteFileCache(Context context)
Load up a file cache using internal storage's cache directory
| |||||||||||
SQLiteFileCache(File location)
Load up a file cache using a custom defined location
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
FileInputStream |
get(AbstractClient client, String id)
Get a file from the local file cache.
| ||||||||||
File |
getCacheDir()
get a pointer to the current cache dir
| ||||||||||
String |
getFilenameForID(AbstractClient client, String id)
Retrieve the filename of the file associated with the provided id
| ||||||||||
synchronized void |
save(AbstractClient client, FileMetaData meta, byte[] data)
Save a file into the file cache
| ||||||||||
void |
trimCache(Context context)
This method compares the current size of all files in the cache dir to the limit size.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Load up a file cache using internal storage's cache directory
Load up a file cache using a custom defined location
Get a file from the local file cache. If the file is not present, then this method will return null.
the file cache uses a sqlite table internally to maintain metadata about all locally stored files.client | the current active client associated with the applications |
---|---|
id | the id of the file to attempt to load |
get a pointer to the current cache dir
Retrieve the filename of the file associated with the provided id
client | the applications' client |
---|---|
id | the id of the file to lookup |
null
or the filename
Save a file into the file cache
client | the current client |
---|---|
meta | the filemetadata associated with the file |
data | the data of the file to write to disk |
This method compares the current size of all files in the cache dir to the limit size. If there are too many files, an async task will be kicked off to delete older files.
context | - the current application's context |
---|