com.google.android.exoplayer2.upstream.cache.Cache.CacheException Java Examples
The following examples show how to use
com.google.android.exoplayer2.upstream.cache.Cache.CacheException.
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: LeastRecentlyUsedCacheEvictor.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void evictCache(Cache cache, long requiredSpace) { while (currentSize + requiredSpace > maxBytes && !leastRecentlyUsed.isEmpty()) { try { cache.removeSpan(leastRecentlyUsed.first()); } catch (CacheException e) { // do nothing. } } }
Example #2
Source File: LeastRecentlyUsedCacheEvictor.java From Telegram with GNU General Public License v2.0 | 5 votes |
private void evictCache(Cache cache, long requiredSpace) { while (currentSize + requiredSpace > maxBytes && !leastRecentlyUsed.isEmpty()) { try { cache.removeSpan(leastRecentlyUsed.first()); } catch (CacheException e) { // do nothing. } } }
Example #3
Source File: LeastRecentlyUsedCacheEvictor.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
private void evictCache(Cache cache, long requiredSpace) { while (currentSize + requiredSpace > maxBytes && !leastRecentlyUsed.isEmpty()) { try { cache.removeSpan(leastRecentlyUsed.first()); } catch (CacheException e) { // do nothing. } } }
Example #4
Source File: LeastRecentlyUsedCacheEvictor.java From K-Sonic with MIT License | 5 votes |
private void evictCache(Cache cache, long requiredSpace) { while (currentSize + requiredSpace > maxBytes) { try { cache.removeSpan(leastRecentlyUsed.first()); } catch (CacheException e) { // do nothing. } } }
Example #5
Source File: CachedContent.java From K-Sonic with MIT License | 5 votes |
/** * Copies the given span with an updated last access time. Passed span becomes invalid after this * call. * * @param cacheSpan Span to be copied and updated. * @return a span with the updated last access time. * @throws CacheException If renaming of the underlying span file failed. */ public SimpleCacheSpan touch(SimpleCacheSpan cacheSpan) throws CacheException { // Remove the old span from the in-memory representation. Assertions.checkState(cachedSpans.remove(cacheSpan)); // Obtain a new span with updated last access timestamp. SimpleCacheSpan newCacheSpan = cacheSpan.copyWithUpdatedLastAccessTime(id); // Rename the cache file if (!cacheSpan.file.renameTo(newCacheSpan.file)) { throw new CacheException("Renaming of " + cacheSpan.file + " to " + newCacheSpan.file + " failed."); } // Add the updated span back into the in-memory representation. cachedSpans.add(newCacheSpan); return newCacheSpan; }
Example #6
Source File: CachedContentIndex.java From K-Sonic with MIT License | 5 votes |
/** Stores the index data to index file if there is a change. */ public void store() throws CacheException { if (!changed) { return; } writeFile(); changed = false; }
Example #7
Source File: CachedContent.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Copies the given span with an updated last access time. Passed span becomes invalid after this * call. * * @param cacheSpan Span to be copied and updated. * @return a span with the updated last access time. * @throws CacheException If renaming of the underlying span file failed. */ public SimpleCacheSpan touch(SimpleCacheSpan cacheSpan) throws CacheException { // Remove the old span from the in-memory representation. Assertions.checkState(cachedSpans.remove(cacheSpan)); // Obtain a new span with updated last access timestamp. SimpleCacheSpan newCacheSpan = cacheSpan.copyWithUpdatedLastAccessTime(id); // Rename the cache file if (!cacheSpan.file.renameTo(newCacheSpan.file)) { throw new CacheException("Renaming of " + cacheSpan.file + " to " + newCacheSpan.file + " failed."); } // Add the updated span back into the in-memory representation. cachedSpans.add(newCacheSpan); return newCacheSpan; }
Example #8
Source File: CachedContentIndex.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** Stores the index data to index file if there is a change. */ public void store() throws CacheException { if (!changed) { return; } writeFile(); changed = false; }
Example #9
Source File: LeastRecentlyUsedCacheEvictor.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
private void evictCache(Cache cache, long requiredSpace) { while (currentSize + requiredSpace > maxBytes && !leastRecentlyUsed.isEmpty()) { try { cache.removeSpan(leastRecentlyUsed.first()); } catch (CacheException e) { // do nothing. } } }
Example #10
Source File: CachedContent.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * Copies the given span with an updated last access time. Passed span becomes invalid after this * call. * * @param cacheSpan Span to be copied and updated. * @return a span with the updated last access time. * @throws CacheException If renaming of the underlying span file failed. */ public SimpleCacheSpan touch(SimpleCacheSpan cacheSpan) throws CacheException { // Remove the old span from the in-memory representation. Assertions.checkState(cachedSpans.remove(cacheSpan)); // Obtain a new span with updated last access timestamp. SimpleCacheSpan newCacheSpan = cacheSpan.copyWithUpdatedLastAccessTime(id); // Rename the cache file if (!cacheSpan.file.renameTo(newCacheSpan.file)) { throw new CacheException("Renaming of " + cacheSpan.file + " to " + newCacheSpan.file + " failed."); } // Add the updated span back into the in-memory representation. cachedSpans.add(newCacheSpan); return newCacheSpan; }
Example #11
Source File: CachedContentIndex.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** Stores the index data to index file if there is a change. */ public void store() throws CacheException { if (!changed) { return; } writeFile(); changed = false; }
Example #12
Source File: LeastRecentlyUsedCacheEvictor.java From MediaSDK with Apache License 2.0 | 5 votes |
private void evictCache(Cache cache, long requiredSpace) { while (currentSize + requiredSpace > maxBytes && !leastRecentlyUsed.isEmpty()) { try { cache.removeSpan(leastRecentlyUsed.first()); } catch (CacheException e) { // do nothing. } } }
Example #13
Source File: CacheDataSource.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void handleBeforeThrow(IOException exception) { if (isReadingFromCache() || exception instanceof CacheException) { seenCacheError = true; } }
Example #14
Source File: CacheDataSource.java From MediaSDK with Apache License 2.0 | 4 votes |
private void handleBeforeThrow(Throwable exception) { if (isReadingFromCache() || exception instanceof CacheException) { seenCacheError = true; } }
Example #15
Source File: CacheDataSource.java From K-Sonic with MIT License | 4 votes |
private void handleBeforeThrow(IOException exception) { if (currentDataSource == cacheReadDataSource || exception instanceof CacheException) { seenCacheError = true; } }
Example #16
Source File: CacheDataSource.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
private void handleBeforeThrow(Throwable exception) { if (isReadingFromCache() || exception instanceof CacheException) { seenCacheError = true; } }
Example #17
Source File: CacheDataSource.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
private void handleBeforeThrow(IOException exception) { if (isReadingFromCache() || exception instanceof CacheException) { seenCacheError = true; } }
Example #18
Source File: CacheDataSource.java From Telegram with GNU General Public License v2.0 | 4 votes |
private void handleBeforeThrow(Throwable exception) { if (isReadingFromCache() || exception instanceof CacheException) { seenCacheError = true; } }