/**
*
*/
private void initCacheFile() {
try {
httpCacheDir = new File(getCacheDir(), "http");
httpCacheDir.setReadable(true);
HttpResponseCache.install(httpCacheDir, httpCacheSize);
cache = new Cache(httpCacheDir, httpCacheSize);
} catch (Exception e) {
e.printStackTrace();
}
}
java类android.net.http.HttpResponseCache的实例源码
CoffeePlacesApplication.java 文件源码
项目:UnCafe
阅读 23
收藏 0
点赞 0
评论 0
MyApplication.java 文件源码
项目:android-rest-example
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void onTerminate() {
super.onTerminate();
// TODO clear cookiestore content here
// remove cached files
HttpResponseCache cache = HttpResponseCache.getInstalled();
if (cache != null) {
cache.flush();
}
}
Podcatcher.java 文件源码
项目:Podcatcher-Deluxe-Android-Studio
阅读 22
收藏 0
点赞 0
评论 0
@Override
public void run() {
Process.setThreadPriority(THREAD_PRIORITY_BACKGROUND);
final HttpResponseCache cache = HttpResponseCache.getInstalled();
if (cache != null)
cache.flush();
}
DefaultDownloader.java 文件源码
项目:PkRSS
阅读 18
收藏 0
点赞 0
评论 0
public DefaultDownloader(Context context) {
cacheDir = new File(context.getCacheDir(), "http");
try {
HttpResponseCache.install(cacheDir, cacheSize);
}
catch (IOException e) {
Log.i(TAG, "HTTP response cache installation failed:" + e);
}
}
SadPandaApp.java 文件源码
项目:SadPanda
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void onCreate() {
super.onCreate();
File httpCacheDir = new File(getCacheDir(), "http");
try {
HttpResponseCache.install(httpCacheDir, HTTP_CACHE_SIZE);
}
catch (IOException e) {
Log.e(TAG, "Failed to create http cache!", e);
}
}
ImpellerApplication.java 文件源码
项目:Impeller
阅读 21
收藏 0
点赞 0
评论 0
private void tryInstallResponseCache() {
if(HttpResponseCache.getInstalled() == null) {
File cacheDir = new File(getCacheDir(), "http");
try {
HttpResponseCache.install(cacheDir, 10 * 1024 * 1024);
} catch (IOException e) {
Log.w(TAG, "Creating response cache", e);
}
}
}
AviewApplication.java 文件源码
项目:aview
阅读 21
收藏 0
点赞 0
评论 0
@AfterInject
@Trace(tag = TAG, level = Log.DEBUG)
void init() {
// if (BuildConfig.DEBUG) {
// aviewPrefs.pref_openedDrawer().put(false);
// }
// Create a unique id for this install if one doesn't already exist
if (!aviewPrefs.ivid().exists()) {
if (Log.isLoggable(TAG, Log.DEBUG))
Log.d(TAG, "Creating new ivid");
aviewPrefs.ivid().put(UUID.randomUUID().toString());
}
if (Log.isLoggable(TAG, Log.DEBUG))
Log.d(TAG, "ivid=" + aviewPrefs.ivid().get());
// Create a cache for automatically caching HTTP requests
try {
File httpCacheDir = new File(this.getCacheDir(), "http");
long httpCacheSize = 10 * 1024 * 1024; // 10 MiB
HttpResponseCache.install(httpCacheDir, httpCacheSize);
} catch (IOException e) {
if (Log.isLoggable(TAG, Log.INFO))
Log.i(TAG, "HTTP response cache installation failed:" + e);
}
}
AviewApplication.java 文件源码
项目:aview
阅读 21
收藏 0
点赞 0
评论 0
@Override
@Trace
public void onTerminate() {
super.onTerminate();
aviewVideoService.close();
HttpResponseCache cache = HttpResponseCache.getInstalled();
if (cache != null) {
cache.flush();
}
}
HomeActivity.java 文件源码
项目:xr
阅读 29
收藏 0
点赞 0
评论 0
@Override
protected void onStop() {
HttpResponseCache cache = HttpResponseCache.getInstalled();
if (cache != null) {
cache.flush();
}
eventBus.unregister(this);
super.onStop();
}
FileCache.java 文件源码
项目:android-restless
阅读 31
收藏 0
点赞 0
评论 0
public FileCache(File file, long size) throws IOException {
this.file = file;
this.size = size;
HttpResponseCache.install(file, size);
}