okhttp3.Cache.urlToKey()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中okhttp3.Cache.urlToKey()方法的一些代码示例,展示了Cache.urlToKey()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Cache.urlToKey()方法的具体详情如下:
包路径:okhttp3.Cache
类名称:Cache
方法名:urlToKey

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;
}

相关文章