Class HttpDataSource.BaseFactory
- java.lang.Object
-
- com.google.android.exoplayer2.upstream.HttpDataSource.BaseFactory
-
- All Implemented Interfaces:
DataSource.Factory
,HttpDataSource.Factory
- Direct Known Subclasses:
CronetDataSourceFactory
,OkHttpDataSourceFactory
- Enclosing interface:
- HttpDataSource
public abstract static class HttpDataSource.BaseFactory extends Object implements HttpDataSource.Factory
Base implementation ofHttpDataSource.Factory
that sets default request properties.
-
-
Constructor Summary
Constructors Constructor Description BaseFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description HttpDataSource
createDataSource()
Creates aDataSource
instance.protected abstract HttpDataSource
createDataSourceInternal(HttpDataSource.RequestProperties defaultRequestProperties)
Called bycreateDataSource()
to create aHttpDataSource
instance.HttpDataSource.Factory
setDefaultRequestProperties(Map<String,String> defaultRequestProperties)
Sets the default request headers forHttpDataSource
instances created by the factory.
-
-
-
Method Detail
-
createDataSource
public final HttpDataSource createDataSource()
Description copied from interface:DataSource.Factory
Creates aDataSource
instance.- Specified by:
createDataSource
in interfaceDataSource.Factory
- Specified by:
createDataSource
in interfaceHttpDataSource.Factory
-
setDefaultRequestProperties
@CanIgnoreReturnValue public final HttpDataSource.Factory setDefaultRequestProperties(Map<String,String> defaultRequestProperties)
Description copied from interface:HttpDataSource.Factory
Sets the default request headers forHttpDataSource
instances created by the factory.The new request properties will be used for future requests made by
HttpDataSources
created by the factory, including instances that have already been created. Modifying thedefaultRequestProperties
map after a call to this method will have no effect, and so it's necessary to call this method again each time the request properties need to be updated.- Specified by:
setDefaultRequestProperties
in interfaceHttpDataSource.Factory
- Parameters:
defaultRequestProperties
- The default request properties.- Returns:
- This factory.
-
createDataSourceInternal
protected abstract HttpDataSource createDataSourceInternal(HttpDataSource.RequestProperties defaultRequestProperties)
Called bycreateDataSource()
to create aHttpDataSource
instance.- Parameters:
defaultRequestProperties
- The defaultRequestProperties
to be used by theHttpDataSource
instance.- Returns:
- A
HttpDataSource
instance.
-
-