/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a {@link HttpDataSource.InvalidContentTypeException} * is thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' * Cache-Control header. For example, you could force the network * response for all requests. */ private OkHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { DmlApplication.getInstance().getBackendComponent().inject(this); Assertions.checkNotNull(callFactory); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link com.google.android.exoplayer.upstream.HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' Cache-Control * header. For example, you could force the network response for all requests. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { this.okHttpClient = Assertions.checkNotNull(client); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is * rejected by the predicate then a {@link HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is * interpreted as an infinite timeout. Pass {@link #DEFAULT_CONNECT_TIMEOUT_MILLIS} to use * the default value. * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted * as an infinite timeout. Pass {@link #DEFAULT_READ_TIMEOUT_MILLIS} to use the default value. * @param allowCrossProtocolRedirects Whether cross-protocol redirects (i.e. redirects from HTTP * to HTTPS and vice versa) are enabled. */ public DefaultHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, int connectTimeoutMillis, int readTimeoutMillis, boolean allowCrossProtocolRedirects) { this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.requestProperties = new HashMap<>(); this.connectTimeoutMillis = connectTimeoutMillis; this.readTimeoutMillis = readTimeoutMillis; this.allowCrossProtocolRedirects = allowCrossProtocolRedirects; }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link com.google.android.exoplayer.upstream.HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' Cache-Control * header. For example, you could force the network response for all requests. * */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { this.okHttpClient = Assertions.checkNotNull(client); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param cacheControl An optional {@link CacheControl} which sets all requests' Cache-Control * header. For example, you could force the network response for all requests. * */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, CacheControl cacheControl) { this.okHttpClient = Assertions.checkNotNull(client); this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.cacheControl = cacheControl; this.requestProperties = new HashMap<>(); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is * rejected by the predicate then a {@link InvalidContentTypeException} is thrown from * {@link #open(DataSpec)}. * @param listener An optional listener. * @param connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is * interpreted as an infinite timeout. * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted * as an infinite timeout. */ public HttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, int connectTimeoutMillis, int readTimeoutMillis) { this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.requestProperties = new HashMap<String, String>(); this.connectTimeoutMillis = connectTimeoutMillis; this.readTimeoutMillis = readTimeoutMillis; }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link com.google.android.exoplayer.util.Predicate}. If a content type is * rejected by the predicate then a {@link InvalidContentTypeException} is thrown from * {@link #open(com.google.android.exoplayer.upstream.DataSpec)}. * @param listener An optional listener. * @param connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is * interpreted as an infinite timeout. * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted * as an infinite timeout. */ public RawHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, int connectTimeoutMillis, int readTimeoutMillis) { this.userAgent = Assertions.checkNotEmpty(userAgent); this.contentTypePredicate = contentTypePredicate; this.listener = listener; this.requestProperties = new HashMap<String, String>(); this.connectTimeoutMillis = connectTimeoutMillis; this.readTimeoutMillis = readTimeoutMillis; }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link com.google.android.exoplayer.upstream.HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate) { this(client, userAgent, contentTypePredicate, null); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link com.google.android.exoplayer.upstream.HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(client, userAgent, contentTypePredicate, listener, null); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is * rejected by the predicate then a {@link HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. */ public DefaultHttpDataSource(String userAgent, Predicate<String> contentTypePredicate) { this(userAgent, contentTypePredicate, null); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is * rejected by the predicate then a {@link HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. */ public DefaultHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT_MILLIS); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is * rejected by the predicate then a {@link HttpDataSource.InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. * @param connectTimeoutMillis The connection timeout, in milliseconds. A timeout of zero is * interpreted as an infinite timeout. * @param readTimeoutMillis The read timeout, in milliseconds. A timeout of zero is interpreted * as an infinite timeout. */ public DefaultHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener, int connectTimeoutMillis, int readTimeoutMillis) { this(userAgent, contentTypePredicate, listener, connectTimeoutMillis, readTimeoutMillis, false); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a {@link HttpDataSource.InvalidContentTypeException} * is thrown from {@link #open(DataSpec)}. */ public OkHttpDataSource(String userAgent, Predicate<String> contentTypePredicate) { this(userAgent, contentTypePredicate, null); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a {@link HttpDataSource.InvalidContentTypeException} * is thrown from {@link #open(DataSpec)}. * @param listener An optional listener. */ public OkHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(userAgent, contentTypePredicate, listener, null); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate) { this(client, userAgent, contentTypePredicate, null); }
/** * @param client An {@link OkHttpClient} for use by the source. * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is rejected by the * predicate then a * {@link InvalidContentTypeException} is * thrown from {@link #open(DataSpec)}. * @param listener An optional listener. */ public OkHttpDataSource(OkHttpClient client, String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(client, userAgent, contentTypePredicate, listener, null); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is * rejected by the predicate then a {@link InvalidContentTypeException} is thrown from * {@link #open(DataSpec)}. */ public HttpDataSource(String userAgent, Predicate<String> contentTypePredicate) { this(userAgent, contentTypePredicate, null); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link Predicate}. If a content type is * rejected by the predicate then a {@link InvalidContentTypeException} is thrown from * {@link #open(DataSpec)}. * @param listener An optional listener. */ public HttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT_MILLIS); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link com.google.android.exoplayer.util.Predicate}. If a content type is * rejected by the predicate then a {@link InvalidContentTypeException} is thrown from * {@link #open(com.google.android.exoplayer.upstream.DataSpec)}. */ public RawHttpDataSource(String userAgent, Predicate<String> contentTypePredicate) { this(userAgent, contentTypePredicate, null); }
/** * @param userAgent The User-Agent string that should be used. * @param contentTypePredicate An optional {@link com.google.android.exoplayer.util.Predicate}. If a content type is * rejected by the predicate then a {@link InvalidContentTypeException} is thrown from * {@link #open(com.google.android.exoplayer.upstream.DataSpec)}. * @param listener An optional listener. */ public RawHttpDataSource(String userAgent, Predicate<String> contentTypePredicate, TransferListener listener) { this(userAgent, contentTypePredicate, listener, DEFAULT_CONNECT_TIMEOUT_MILLIS, DEFAULT_READ_TIMEOUT_MILLIS); }