Package com.castlabs.android.network

## Interface DataSourceFactory

- All Superinterfaces:
    `com.google.android.exoplayer2.upstream.DataSource.Factory`
  All Known Implementing Classes:
    `DefaultDataSourceFactory`, `ModifierDataSourceFactory`

      public interface DataSourceFactory
      extends com.google.android.exoplayer2.upstream.DataSource.Factory

  Implementations of this interface are used to create `DataSource`s to fetch remote data. The implementation should allow to customize both header and query parameters for generated data sources.

  Please use the `PlayerSDK.HTTP_DATASOURCE_BUILDER` as the source for any `HttpDataSource` instances.
  Since:
    3.0.0

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `addHeaderParameter​(String key, String value)` | Adds a header parameter that will be added to each HTTP connection header that is generated with a `DataSource` created by this factory.
    `void` | `addQueryParameter​(String key, String value)` | Adds a query parameter that will be appended to each HTTP URL.
    `void` | `clearHeaderParameters()` | Removes all header parameters added previously with `addHeaderParameter(String, String)`.
    `void` | `clearQueryParameters()` | Removes all query parameters added previously with `addQueryParameter(String, String)`
    `com.google.android.exoplayer2.upstream.DataSource` | `createDataSource​(int requestType)` | Creates a data source for the given request type
    `Map<String,​String>` | `getHeaderParameter()` |
    `Map<String,​String>` | `getQueryParameter()` |

    - ### Methods inherited from interface com.google.android.exoplayer2.upstream.DataSource.Factory

      `createDataSource`

- - ### Method Detail

    - #### addHeaderParameter

          void addHeaderParameter​(@NonNull
                                  String key,
                                  @NonNull
                                  String value)

      Adds a header parameter that will be added to each HTTP connection header that is generated with a `DataSource` created by this factory.

      Note that you will need to call this before a call to `DataSource.Factory.createDataSource()` in order to successfully add the parameter.
      Parameters:
        `key` - the key
        `value` - the value or null to remove any previously added endtry with the given key

    - #### clearHeaderParameters

          void clearHeaderParameters()

      Removes all header parameters added previously with `addHeaderParameter(String, String)`.

    - #### addQueryParameter

          void addQueryParameter​(@NonNull
                                 String key,
                                 @NonNull
                                 String value)

      Adds a query parameter that will be appended to each HTTP URL.

      Note that you will need to call this before a call to `DataSource.Factory.createDataSource()` in order to successfully add the parameter.
      Parameters:
        `key` - the key
        `value` - the value or null to remove any previously added entry with the given key

    - #### clearQueryParameters

          void clearQueryParameters()

      Removes all query parameters added previously with `addQueryParameter(String, String)`

    - #### getHeaderParameter

          @NonNull
          Map<String,​String> getHeaderParameter()

      Returns:
        A non-null map of all registered header parameter

    - #### getQueryParameter

          @NonNull
          Map<String,​String> getQueryParameter()

      Returns:
        A non-null map of all registered query parameter

    - #### createDataSource

          com.google.android.exoplayer2.upstream.DataSource createDataSource​(int requestType)

      Creates a data source for the given request type
      Parameters:
        `requestType` - The request type
      Returns:
        dataSource the data source