Java Code Examples for com.squareup.okhttp.internal.DiskLruCache#open()
The following examples show how to use
com.squareup.okhttp.internal.DiskLruCache#open() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GifLoadTask.java From sctalk with Apache License 2.0 | 6 votes |
private FilterInputStream getFromCache(String url) throws Exception { DiskLruCache cache = DiskLruCache.open(CommonUtil.getImageSavePath(), 1, 2, 2*1024*1024); cache.flush(); String key = Util.hash(url); final DiskLruCache.Snapshot snapshot; try { snapshot = cache.get(key); if (snapshot == null) { return null; } } catch (IOException e) { return null; } FilterInputStream bodyIn = new FilterInputStream(snapshot.getInputStream(1)) { @Override public void close() throws IOException { snapshot.close(); super.close(); } }; return bodyIn; }
Example 2
Source File: DataModule.java From githot with Apache License 2.0 | 5 votes |
@Provides @Singleton DiskLruCache provideDataCache(@Named("Data") File cacheDir) { DiskLruCache cache = null; try { //10M cache = DiskLruCache.open(cacheDir, BuildConfig.VERSION_CODE, 1, 1024 * 1024 * 10); } catch (IOException e) { e.printStackTrace(); L.e(e + "install data cache failed"); } return cache; }
Example 3
Source File: DataModule.java From Sky31Radio with Apache License 2.0 | 5 votes |
@Provides @Singleton DiskLruCache provideDataCache(@Named("Data") File cacheDir){ DiskLruCache cache = null; try { //10M cache = DiskLruCache.open(cacheDir, BuildConfig.VERSION_CODE, 1, 1024 * 1024 * 10); } catch (IOException e) { e.printStackTrace(); Timber.e(e, "install data cache failed"); } return cache; }
Example 4
Source File: HttpResponseCache.java From cordova-amazon-fireos with Apache License 2.0 | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 5
Source File: HttpResponseCache.java From crosswalk-cordova-android with Apache License 2.0 | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 6
Source File: HttpResponseCache.java From phonegap-plugin-loading-spinner with Apache License 2.0 | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 7
Source File: HttpResponseCache.java From phonegap-plugin-loading-spinner with Apache License 2.0 | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 8
Source File: HttpResponseCache.java From wildfly-samples with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 9
Source File: HttpResponseCache.java From cordova-android-chromeview with Apache License 2.0 | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 10
Source File: HttpResponseCache.java From cordova-android-chromeview with Apache License 2.0 | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 11
Source File: HttpResponseCache.java From CordovaYoutubeVideoPlayer with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 12
Source File: HttpResponseCache.java From phonegapbootcampsite with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 13
Source File: HttpResponseCache.java From reader with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 14
Source File: HttpResponseCache.java From reader with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 15
Source File: HttpResponseCache.java From bluemix-parking-meter with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 16
Source File: HttpResponseCache.java From android-discourse with Apache License 2.0 | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 17
Source File: HttpResponseCache.java From IoTgo_Android_App with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }
Example 18
Source File: HttpResponseCache.java From L.TileLayer.Cordova with MIT License | 4 votes |
public HttpResponseCache(File directory, long maxSize) throws IOException { cache = DiskLruCache.open(directory, VERSION, ENTRY_COUNT, maxSize); }