com.google.android.exoplayer2.upstream.DataSink Java Examples
The following examples show how to use
com.google.android.exoplayer2.upstream.DataSink.
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: CacheDataSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. * @param cacheKeyFactory An optional factory for cache keys. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, @Nullable DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.cacheReadDataSource = cacheReadDataSource; this.cacheKeyFactory = cacheKeyFactory != null ? cacheKeyFactory : CacheUtil.DEFAULT_CACHE_KEY_FACTORY; this.blockOnCache = (flags & FLAG_BLOCK_ON_CACHE) != 0; this.ignoreCacheOnError = (flags & FLAG_IGNORE_CACHE_ON_ERROR) != 0; this.ignoreCacheForUnsetLengthRequests = (flags & FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS) != 0; this.upstreamDataSource = upstream; if (cacheWriteDataSink != null) { this.cacheWriteDataSource = new TeeDataSource(upstream, cacheWriteDataSink); } else { this.cacheWriteDataSource = null; } this.eventListener = eventListener; }
Example #2
Source File: CacheDataSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. * @param cacheKeyFactory An optional factory for cache keys. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, @Nullable DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.cacheReadDataSource = cacheReadDataSource; this.cacheKeyFactory = cacheKeyFactory != null ? cacheKeyFactory : CacheUtil.DEFAULT_CACHE_KEY_FACTORY; this.blockOnCache = (flags & FLAG_BLOCK_ON_CACHE) != 0; this.ignoreCacheOnError = (flags & FLAG_IGNORE_CACHE_ON_ERROR) != 0; this.ignoreCacheForUnsetLengthRequests = (flags & FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS) != 0; this.upstreamDataSource = upstream; if (cacheWriteDataSink != null) { this.cacheWriteDataSource = new TeeDataSource(upstream, cacheWriteDataSink); } else { this.cacheWriteDataSource = null; } this.eventListener = eventListener; }
Example #3
Source File: CacheDataSourceFactory.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * CacheDataSource.EventListener) */ public CacheDataSourceFactory( Cache cache, DataSource.Factory upstreamFactory, DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, @Nullable CacheDataSource.EventListener eventListener) { this( cache, upstreamFactory, cacheReadDataSourceFactory, cacheWriteDataSinkFactory, flags, eventListener, /* cacheKeyFactory= */ null); }
Example #4
Source File: CacheDataSourceFactory.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * CacheDataSource.EventListener, CacheKeyFactory) */ public CacheDataSourceFactory( Cache cache, DataSource.Factory upstreamFactory, DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, @Nullable CacheDataSource.EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.upstreamFactory = upstreamFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.flags = flags; this.eventListener = eventListener; this.cacheKeyFactory = cacheKeyFactory; }
Example #5
Source File: DownloaderConstructorHelper.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns a new {@link CacheDataSource} instance. If {@code offline} is true, it can only read * data from the cache. */ public CacheDataSource buildCacheDataSource(boolean offline) { DataSource cacheReadDataSource = cacheReadDataSourceFactory != null ? cacheReadDataSourceFactory.createDataSource() : new FileDataSource(); if (offline) { return new CacheDataSource(cache, DummyDataSource.INSTANCE, cacheReadDataSource, null, CacheDataSource.FLAG_BLOCK_ON_CACHE, null); } else { DataSink cacheWriteDataSink = cacheWriteDataSinkFactory != null ? cacheWriteDataSinkFactory.createDataSink() : new CacheDataSink(cache, CacheDataSource.DEFAULT_MAX_CACHE_FILE_SIZE); DataSource upstream = upstreamDataSourceFactory.createDataSource(); upstream = priorityTaskManager == null ? upstream : new PriorityDataSource(upstream, priorityTaskManager, C.PRIORITY_DOWNLOAD); return new CacheDataSource(cache, upstream, cacheReadDataSource, cacheWriteDataSink, CacheDataSource.FLAG_BLOCK_ON_CACHE, null); } }
Example #6
Source File: CacheDataSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. * @param cacheKeyFactory An optional factory for cache keys. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.cacheReadDataSource = cacheReadDataSource; this.cacheKeyFactory = cacheKeyFactory != null ? cacheKeyFactory : CacheUtil.DEFAULT_CACHE_KEY_FACTORY; this.blockOnCache = (flags & FLAG_BLOCK_ON_CACHE) != 0; this.ignoreCacheOnError = (flags & FLAG_IGNORE_CACHE_ON_ERROR) != 0; this.ignoreCacheForUnsetLengthRequests = (flags & FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS) != 0; this.upstreamDataSource = upstream; if (cacheWriteDataSink != null) { this.cacheWriteDataSource = new TeeDataSource(upstream, cacheWriteDataSink); } else { this.cacheWriteDataSource = null; } this.eventListener = eventListener; }
Example #7
Source File: CacheDataSource.java From Telegram-FOSS with GNU General Public License v2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, @Nullable DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener) { this( cache, upstream, cacheReadDataSource, cacheWriteDataSink, flags, eventListener, /* cacheKeyFactory= */ null); }
Example #8
Source File: CacheDataSource.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. * @param cacheKeyFactory An optional factory for cache keys. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.cacheReadDataSource = cacheReadDataSource; this.cacheKeyFactory = cacheKeyFactory != null ? cacheKeyFactory : CacheUtil.DEFAULT_CACHE_KEY_FACTORY; this.blockOnCache = (flags & FLAG_BLOCK_ON_CACHE) != 0; this.ignoreCacheOnError = (flags & FLAG_IGNORE_CACHE_ON_ERROR) != 0; this.ignoreCacheForUnsetLengthRequests = (flags & FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS) != 0; this.upstreamDataSource = upstream; if (cacheWriteDataSink != null) { this.cacheWriteDataSource = new TeeDataSource(upstream, cacheWriteDataSink); } else { this.cacheWriteDataSource = null; } this.eventListener = eventListener; }
Example #9
Source File: CacheDataSource.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, @Nullable DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener) { this( cache, upstream, cacheReadDataSource, cacheWriteDataSink, flags, eventListener, /* cacheKeyFactory= */ null); }
Example #10
Source File: DownloaderConstructorHelper.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns a new {@link CacheDataSource} instance. If {@code offline} is true, it can only read * data from the cache. */ public CacheDataSource buildCacheDataSource(boolean offline) { DataSource cacheReadDataSource = cacheReadDataSourceFactory != null ? cacheReadDataSourceFactory.createDataSource() : new FileDataSource(); if (offline) { return new CacheDataSource(cache, DummyDataSource.INSTANCE, cacheReadDataSource, null, CacheDataSource.FLAG_BLOCK_ON_CACHE, null); } else { DataSink cacheWriteDataSink = cacheWriteDataSinkFactory != null ? cacheWriteDataSinkFactory.createDataSink() : new CacheDataSink(cache, CacheDataSource.DEFAULT_MAX_CACHE_FILE_SIZE); DataSource upstream = upstreamDataSourceFactory.createDataSource(); upstream = priorityTaskManager == null ? upstream : new PriorityDataSource(upstream, priorityTaskManager, C.PRIORITY_DOWNLOAD); return new CacheDataSource(cache, upstream, cacheReadDataSource, cacheWriteDataSink, CacheDataSource.FLAG_BLOCK_ON_CACHE, null); } }
Example #11
Source File: CacheDataSource.java From K-Sonic with MIT License | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE} and {@link * #FLAG_IGNORE_CACHE_ON_ERROR} or 0. * @param eventListener An optional {@link EventListener} to receive events. */ public CacheDataSource(Cache cache, DataSource upstream, DataSource cacheReadDataSource, DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener) { this.cache = cache; this.cacheReadDataSource = cacheReadDataSource; this.blockOnCache = (flags & FLAG_BLOCK_ON_CACHE) != 0; this.ignoreCacheOnError = (flags & FLAG_IGNORE_CACHE_ON_ERROR) != 0; this.ignoreCacheForUnsetLengthRequests = (flags & FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS) != 0; this.upstreamDataSource = upstream; if (cacheWriteDataSink != null) { this.cacheWriteDataSource = new TeeDataSource(upstream, cacheWriteDataSink); } else { this.cacheWriteDataSource = null; } this.eventListener = eventListener; }
Example #12
Source File: CacheDataSourceFactory.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * CacheDataSource.EventListener) */ public CacheDataSourceFactory( Cache cache, DataSource.Factory upstreamFactory, DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, @Nullable CacheDataSource.EventListener eventListener) { this( cache, upstreamFactory, cacheReadDataSourceFactory, cacheWriteDataSinkFactory, flags, eventListener, /* cacheKeyFactory= */ null); }
Example #13
Source File: CacheDataSourceFactory.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * CacheDataSource.EventListener, CacheKeyFactory) */ public CacheDataSourceFactory( Cache cache, DataSource.Factory upstreamFactory, DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, @Nullable CacheDataSource.EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.upstreamFactory = upstreamFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.flags = flags; this.eventListener = eventListener; this.cacheKeyFactory = cacheKeyFactory; }
Example #14
Source File: CacheDataSourceFactory.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * CacheDataSource.EventListener) */ public CacheDataSourceFactory( Cache cache, DataSource.Factory upstreamFactory, DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, @Nullable CacheDataSource.EventListener eventListener) { this( cache, upstreamFactory, cacheReadDataSourceFactory, cacheWriteDataSinkFactory, flags, eventListener, /* cacheKeyFactory= */ null); }
Example #15
Source File: CacheDataSource.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. * @param cacheKeyFactory An optional factory for cache keys. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, @Nullable DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.cacheReadDataSource = cacheReadDataSource; this.cacheKeyFactory = cacheKeyFactory != null ? cacheKeyFactory : CacheUtil.DEFAULT_CACHE_KEY_FACTORY; this.blockOnCache = (flags & FLAG_BLOCK_ON_CACHE) != 0; this.ignoreCacheOnError = (flags & FLAG_IGNORE_CACHE_ON_ERROR) != 0; this.ignoreCacheForUnsetLengthRequests = (flags & FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS) != 0; this.upstreamDataSource = upstream; if (cacheWriteDataSink != null) { this.cacheWriteDataSource = new TeeDataSource(upstream, cacheWriteDataSink); } else { this.cacheWriteDataSource = null; } this.eventListener = eventListener; }
Example #16
Source File: CacheDataSource.java From MediaSDK with Apache License 2.0 | 6 votes |
/** * Constructs an instance with arbitrary {@link DataSource} and {@link DataSink} instances for * reading and writing the cache. One use of this constructor is to allow data to be transformed * before it is written to disk. * * @param cache The cache. * @param upstream A {@link DataSource} for reading data not in the cache. * @param cacheReadDataSource A {@link DataSource} for reading data from the cache. * @param cacheWriteDataSink A {@link DataSink} for writing data to the cache. If null, cache is * accessed read-only. * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR} * and {@link #FLAG_IGNORE_CACHE_FOR_UNSET_LENGTH_REQUESTS}, or 0. * @param eventListener An optional {@link EventListener} to receive events. */ public CacheDataSource( Cache cache, DataSource upstream, DataSource cacheReadDataSource, @Nullable DataSink cacheWriteDataSink, @Flags int flags, @Nullable EventListener eventListener) { this( cache, upstream, cacheReadDataSource, cacheWriteDataSink, flags, eventListener, /* cacheKeyFactory= */ null); }
Example #17
Source File: CacheDataSourceFactory.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * CacheDataSource.EventListener, CacheKeyFactory) */ public CacheDataSourceFactory( Cache cache, DataSource.Factory upstreamFactory, DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, @Nullable CacheDataSource.EventListener eventListener, @Nullable CacheKeyFactory cacheKeyFactory) { this.cache = cache; this.upstreamFactory = upstreamFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.flags = flags; this.eventListener = eventListener; this.cacheKeyFactory = cacheKeyFactory; }
Example #18
Source File: CacheDataSourceFactory.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * EventListener) */ public CacheDataSourceFactory(Cache cache, Factory upstreamFactory, Factory cacheReadDataSourceFactory, DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, EventListener eventListener) { this.cache = cache; this.upstreamFactory = upstreamFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.flags = flags; this.eventListener = eventListener; }
Example #19
Source File: DownloaderConstructorHelper.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * @param cache Cache instance to be used to store downloaded data. * @param upstreamFactory A {@link DataSource.Factory} for creating {@link DataSource}s for * downloading data. * @param cacheReadDataSourceFactory A {@link DataSource.Factory} for creating {@link DataSource}s * for reading data from the cache. If null then a {@link FileDataSourceFactory} will be used. * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for creating {@link DataSource}s * for writing data to the cache. If null then a {@link CacheDataSinkFactory} will be used. * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null, * downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst * downloading. */ public DownloaderConstructorHelper( Cache cache, DataSource.Factory upstreamFactory, @Nullable DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @Nullable PriorityTaskManager priorityTaskManager) { this( cache, upstreamFactory, cacheReadDataSourceFactory, cacheWriteDataSinkFactory, priorityTaskManager, /* cacheKeyFactory= */ null); }
Example #20
Source File: CacheDataSourceFactory.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * EventListener) */ public CacheDataSourceFactory(Cache cache, Factory upstreamFactory, Factory cacheReadDataSourceFactory, DataSink.Factory cacheWriteDataSinkFactory, @CacheDataSource.Flags int flags, EventListener eventListener) { this.cache = cache; this.upstreamFactory = upstreamFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.flags = flags; this.eventListener = eventListener; }
Example #21
Source File: CacheDataSourceFactory.java From K-Sonic with MIT License | 5 votes |
/** * @see CacheDataSource#CacheDataSource(Cache, DataSource, DataSource, DataSink, int, * EventListener) */ public CacheDataSourceFactory(Cache cache, Factory upstreamFactory, Factory cacheReadDataSourceFactory, DataSink.Factory cacheWriteDataSinkFactory, int flags, EventListener eventListener) { this.cache = cache; this.upstreamFactory = upstreamFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.flags = flags; this.eventListener = eventListener; }
Example #22
Source File: DownloaderConstructorHelper.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param cache Cache instance to be used to store downloaded data. * @param upstreamDataSourceFactory A {@link Factory} for downloading data. * @param cacheReadDataSourceFactory A {@link Factory} for reading data from the cache. If null * then standard {@link FileDataSource} instances will be used. * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for writing data to the cache. If * null then standard {@link CacheDataSink} instances will be used. * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null, * downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst * downloading. */ public DownloaderConstructorHelper( Cache cache, Factory upstreamDataSourceFactory, @Nullable Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @Nullable PriorityTaskManager priorityTaskManager) { Assertions.checkNotNull(upstreamDataSourceFactory); this.cache = cache; this.upstreamDataSourceFactory = upstreamDataSourceFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.priorityTaskManager = priorityTaskManager; }
Example #23
Source File: DownloaderConstructorHelper.java From Telegram with GNU General Public License v2.0 | 5 votes |
/** * @param cache Cache instance to be used to store downloaded data. * @param upstreamFactory A {@link DataSource.Factory} for creating {@link DataSource}s for * downloading data. * @param cacheReadDataSourceFactory A {@link DataSource.Factory} for creating {@link DataSource}s * for reading data from the cache. If null then a {@link FileDataSourceFactory} will be used. * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for creating {@link DataSource}s * for writing data to the cache. If null then a {@link CacheDataSinkFactory} will be used. * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null, * downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst * downloading. */ public DownloaderConstructorHelper( Cache cache, DataSource.Factory upstreamFactory, @Nullable DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @Nullable PriorityTaskManager priorityTaskManager) { this( cache, upstreamFactory, cacheReadDataSourceFactory, cacheWriteDataSinkFactory, priorityTaskManager, /* cacheKeyFactory= */ null); }
Example #24
Source File: DownloaderConstructorHelper.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
/** * @param cache Cache instance to be used to store downloaded data. * @param upstreamDataSourceFactory A {@link Factory} for downloading data. * @param cacheReadDataSourceFactory A {@link Factory} for reading data from the cache. If null * then standard {@link FileDataSource} instances will be used. * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for writing data to the cache. If * null then standard {@link CacheDataSink} instances will be used. * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null, * downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst * downloading. */ public DownloaderConstructorHelper( Cache cache, Factory upstreamDataSourceFactory, @Nullable Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @Nullable PriorityTaskManager priorityTaskManager) { Assertions.checkNotNull(upstreamDataSourceFactory); this.cache = cache; this.upstreamDataSourceFactory = upstreamDataSourceFactory; this.cacheReadDataSourceFactory = cacheReadDataSourceFactory; this.cacheWriteDataSinkFactory = cacheWriteDataSinkFactory; this.priorityTaskManager = priorityTaskManager; }
Example #25
Source File: DownloaderConstructorHelper.java From MediaSDK with Apache License 2.0 | 5 votes |
/** * @param cache Cache instance to be used to store downloaded data. * @param upstreamFactory A {@link DataSource.Factory} for creating {@link DataSource}s for * downloading data. * @param cacheReadDataSourceFactory A {@link DataSource.Factory} for creating {@link DataSource}s * for reading data from the cache. If null then a {@link FileDataSource.Factory} will be * used. * @param cacheWriteDataSinkFactory A {@link DataSink.Factory} for creating {@link DataSource}s * for writing data to the cache. If null then a {@link CacheDataSinkFactory} will be used. * @param priorityTaskManager A {@link PriorityTaskManager} to use when downloading. If non-null, * downloaders will register as tasks with priority {@link C#PRIORITY_DOWNLOAD} whilst * downloading. */ public DownloaderConstructorHelper( Cache cache, DataSource.Factory upstreamFactory, @Nullable DataSource.Factory cacheReadDataSourceFactory, @Nullable DataSink.Factory cacheWriteDataSinkFactory, @Nullable PriorityTaskManager priorityTaskManager) { this( cache, upstreamFactory, cacheReadDataSourceFactory, cacheWriteDataSinkFactory, priorityTaskManager, /* cacheKeyFactory= */ null); }
Example #26
Source File: CacheDataSinkFactory.java From Telegram-FOSS with GNU General Public License v2.0 | 4 votes |
@Override public DataSink createDataSink() { return new CacheDataSink(cache, fragmentSize, bufferSize); }
Example #27
Source File: CacheDataSinkFactory.java From Telegram with GNU General Public License v2.0 | 4 votes |
@Override public DataSink createDataSink() { return new CacheDataSink(cache, fragmentSize, bufferSize); }
Example #28
Source File: CacheDataSinkFactory.java From K-Sonic with MIT License | 4 votes |
@Override public DataSink createDataSink() { return new CacheDataSink(cache, maxCacheFileSize, bufferSize); }
Example #29
Source File: CacheDataSinkFactory.java From MediaSDK with Apache License 2.0 | 4 votes |
@Override public DataSink createDataSink() { return new CacheDataSink(cache, fragmentSize, bufferSize); }
Example #30
Source File: CacheDataSinkFactory.java From TelePlus-Android with GNU General Public License v2.0 | 4 votes |
@Override public DataSink createDataSink() { return new CacheDataSink(cache, maxCacheFileSize, bufferSize); }