Java 类com.google.android.exoplayer2.upstream.TeeDataSource 实例源码

项目:Exoplayer2Radio    文件:CacheDataSource.java   
/**
 * 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,
    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;
}
项目:K-Sonic    文件:CacheDataSource.java   
/**
 * 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;
}
项目:videoPickPlayer    文件:CacheDataSource.java   
/**
 * 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.
 * @param flags A combination of {@link #FLAG_BLOCK_ON_CACHE}, {@link #FLAG_IGNORE_CACHE_ON_ERROR}
 *     and {@link #FLAG_CACHE_UNBOUNDED_REQUESTS} or 0.
 * @param eventListener An optional {@link EventListener} to receive events.
 */
public CacheDataSource(Cache cache, DataSource upstream, DataSource cacheReadDataSource,
    DataSink cacheWriteDataSink, @Flags int flags, 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.bypassUnboundedRequests = (flags & FLAG_CACHE_UNBOUNDED_REQUESTS) == 0;
  this.upstreamDataSource = upstream;
  if (cacheWriteDataSink != null) {
    this.cacheWriteDataSource = new TeeDataSource(upstream, cacheWriteDataSink);
  } else {
    this.cacheWriteDataSource = null;
  }
  this.eventListener = eventListener;
}
项目:transistor    文件:CacheDataSource.java   
/**
 * 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,
    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;
}