Package com.google.android.exoplayer2.upstream

## Class HttpDataSource.BaseFactory

- java.lang.Object
- - com.google.android.exoplayer2.upstream.HttpDataSource.BaseFactory

- All Implemented Interfaces:
    `DataSource.Factory`, `HttpDataSource.Factory`
  Direct Known Subclasses:
    `CronetDataSourceFactory`, `DefaultHttpDataSourceFactory`, `OkHttpDataSourceFactory`
  Enclosing interface:
    HttpDataSource

      public abstract static class HttpDataSource.BaseFactory
      extends Object
      implements HttpDataSource.Factory

  Base implementation of `HttpDataSource.Factory` that sets default request properties.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BaseFactory()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `HttpDataSource` | `createDataSource()` | Creates a `DataSource` instance.
    `protected abstract HttpDataSource` | `createDataSourceInternal​(HttpDataSource.RequestProperties defaultRequestProperties)` | Called by `createDataSource()` to create a `HttpDataSource` instance.
    `HttpDataSource.RequestProperties` | `getDefaultRequestProperties()` | Deprecated. Use `setDefaultRequestProperties(Map)` instead.
    `HttpDataSource.Factory` | `setDefaultRequestProperties​(Map<String,​String> defaultRequestProperties)` | Sets the default request headers for `HttpDataSource` instances created by the factory.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BaseFactory

          public BaseFactory()

  - ### Method Detail

    - #### createDataSource

          public final HttpDataSource createDataSource()

      Description copied from interface: `DataSource.Factory`
      Creates a `DataSource` instance.
      Specified by:
        `createDataSource` in interface `DataSource.Factory`
      Specified by:
        `createDataSource` in interface `HttpDataSource.Factory`

    - #### getDefaultRequestProperties

          @Deprecated
          public final HttpDataSource.RequestProperties getDefaultRequestProperties()

      Deprecated.
      Use `setDefaultRequestProperties(Map)` instead.
      Specified by:
        `getDefaultRequestProperties` in interface `HttpDataSource.Factory`

    - #### setDefaultRequestProperties

          public final HttpDataSource.Factory setDefaultRequestProperties​(Map<String,​String> defaultRequestProperties)

      Description copied from interface: `HttpDataSource.Factory`
      Sets the default request headers for `HttpDataSource` 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 the `defaultRequestProperties` 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 interface `HttpDataSource.Factory`
      Parameters:
        `defaultRequestProperties` - The default request properties.
      Returns:
        This factory.

    - #### createDataSourceInternal

          protected abstract HttpDataSource createDataSourceInternal​(HttpDataSource.RequestProperties defaultRequestProperties)

      Called by `createDataSource()` to create a `HttpDataSource` instance.
      Parameters:
        `defaultRequestProperties` - The default `RequestProperties` to be used by the `HttpDataSource` instance.
      Returns:
        A `HttpDataSource` instance.