@Override public <T> void addInCache(Response<T> response, byte[] rawResponse) { String cacheKey = urlToKey(response.raw().request().url().url()); memoryCache.put(cacheKey, rawResponse); try { DiskLruCache.Editor editor = diskCache.edit(urlToKey(response.raw().request().url().url())); editor.set(0, new String(rawResponse, Charset.defaultCharset())); editor.commit(); Log.e("SmartCall", "c缓存成功"); }catch(IOException exc){ Log.e("SmartCall", "", exc); } }
@Override public <T> void addInCache(Response<T> response, byte[] rawResponse) { String cacheKey = urlToKey(response.raw().request().url().url()); memoryCache.put(cacheKey, rawResponse); try { DiskLruCache.Editor editor = diskCache.edit(urlToKey(response.raw().request().url().url())); editor.set(0, new String(rawResponse, Charset.defaultCharset())); editor.commit(); }catch(IOException exc){ Log.e("SmartCall", "", exc); } }
@Override public <T> void addInCache(Response<T> response, byte[] rawResponse) { String cacheKey = urlToKey(response.raw().request().url().url()); memoryCache.put(cacheKey, rawResponse); try { DiskLruCache.Editor editor = diskCache.edit(urlToKey(response.raw().request().url().url())); editor.set(0, new String(rawResponse, Charset.defaultCharset())); editor.commit(); }catch(IOException exc){ Log.e("SmartCall", "", exc); } }
outputStream.flush(); edit.set(1, ifModifiedSince == null ? "" : ifModifiedSince); edit.commit();
return false; editor.set(0, String.valueOf(bytes.length)); outputStream = editor.newOutputStream(1); outputStream.write(bytes);