本文整理了Java中okhttp3.Cache.urlToKey()
方法的一些代码示例,展示了Cache.urlToKey()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.urlToKey()
方法的具体详情如下:
包路径:okhttp3.Cache
类名称:Cache
方法名:urlToKey
暂无
代码示例来源:origin: huxq17/tractor
private void remove(Request request) throws IOException {
cache.remove(urlToKey(request));
}
代码示例来源:origin: huxq17/SwipeCardsView
private void remove(Request request) throws IOException {
cache.remove(urlToKey(request));
}
代码示例来源:origin: duzechao/OKHttpUtils
private void remove(Request request) throws IOException {
cache.remove(urlToKey(request));
}
代码示例来源:origin: huxq17/SwipeCardsView
DiskLruCache.Editor editor = null;
try {
editor = cache.edit(urlToKey(response.request()));
if (editor == null) {
return null;
代码示例来源:origin: duzechao/OKHttpUtils
DiskLruCache.Editor editor = null;
try {
editor = cache.edit(urlToKey(response.request()));
if (editor == null) {
return null;
代码示例来源:origin: huxq17/tractor
DiskLruCache.Editor editor = null;
try {
editor = cache.edit(urlToKey(response.request()));
if (editor == null) {
return null;
代码示例来源:origin: huxq17/tractor
Response get(Request request) {
String key = urlToKey(request);
DiskLruCache.Snapshot snapshot;
Entry entry;
try {
snapshot = cache.get(key);
if (snapshot == null) {
return null;
}
} catch (IOException e) {
// Give up because the cache cannot be read.
return null;
}
try {
entry = new Entry(snapshot.getSource(ENTRY_METADATA));
} catch (IOException e) {
Util.closeQuietly(snapshot);
return null;
}
Response response = entry.response(snapshot);
if (!entry.matches(request, response)) {
Util.closeQuietly(response.body());
return null;
}
return response;
}
代码示例来源:origin: huxq17/SwipeCardsView
Response get(Request request) {
String key = urlToKey(request);
DiskLruCache.Snapshot snapshot;
Entry entry;
try {
snapshot = cache.get(key);
if (snapshot == null) {
return null;
}
} catch (IOException e) {
// Give up because the cache cannot be read.
return null;
}
try {
entry = new Entry(snapshot.getSource(ENTRY_METADATA));
} catch (IOException e) {
Util.closeQuietly(snapshot);
return null;
}
Response response = entry.response(snapshot);
if (!entry.matches(request, response)) {
Util.closeQuietly(response.body());
return null;
}
return response;
}
代码示例来源:origin: duzechao/OKHttpUtils
public Response get(Request request) {
String key = urlToKey(request);
DiskLruCache.Snapshot snapshot;
Entry entry;
try {
snapshot = cache.get(key);
if (snapshot == null) {
return null;
}
} catch (IOException e) {
// Give up because the cache cannot be read.
return null;
}
try {
entry = new Entry(snapshot.getSource(ENTRY_METADATA));
} catch (IOException e) {
Util.closeQuietly(snapshot);
return null;
}
Response response = entry.response(snapshot);
if (!entry.matches(request, response)) {
Util.closeQuietly(response.body());
return null;
}
return response;
}
内容来源于网络,如有侵权,请联系作者删除!