# HttpDataSource.RequestProperties

Artifact: [androidx.media3:media3-datasource](https://developer.android.com/jetpack/androidx/releases/media3) [View Source](https://cs.android.com/search?q=file:androidx/media3/datasource/HttpDataSource.java+class:androidx.media3.datasource.HttpDataSource.RequestProperties)

*** ** * ** ***


```
@UnstableApi
public final class HttpDataSource.RequestProperties
```

<br />

*** ** * ** ***

Stores HTTP request properties (aka HTTP headers) and provides methods to modify the headers in a thread safe way to avoid the potential of creating snapshots of an inconsistent or unintended state.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.RequestProperties#RequestProperties()()` |

| ### Public methods |
|---|---|
| `synchronized void` | `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.RequestProperties#clear()()` Clears all request properties. |
| `synchronized void` | `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.RequestProperties#clearAndSet(java.util.Map<java.lang.String,java.lang.String>)(https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html> properties)` Removes all properties previously existing and sets the keys and values of the map. |
| `synchronized https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.RequestProperties#getSnapshot()()` Gets a snapshot of the request properties. |
| `synchronized void` | `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.RequestProperties#remove(java.lang.String)(https://developer.android.com/reference/java/lang/String.html name)` Removes a request property by name. |
| `synchronized void` | `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.RequestProperties#set(java.util.Map<java.lang.String,java.lang.String>)(https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html> properties)` Sets the keys and values contained in the map. |
| `synchronized void` | `https://developer.android.com/reference/androidx/media3/datasource/HttpDataSource.RequestProperties#set(java.lang.String,java.lang.String)(https://developer.android.com/reference/java/lang/String.html name, https://developer.android.com/reference/java/lang/String.html value)` Sets the specified property `value` for the specified `name`. |

## Public constructors

### RequestProperties

```
public RequestProperties()
```

## Public methods

### clear

```
synchronized public void clear()
```

Clears all request properties.

### clearAndSet

```
synchronized public void clearAndSet(Map<String, String> properties)
```

Removes all properties previously existing and sets the keys and values of the map.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html> properties` | The request properties. |

### getSnapshot

```
synchronized public Map<String, String> getSnapshot()
```

Gets a snapshot of the request properties.

| Returns |
|---|---|
| `https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html>` | A snapshot of the request properties. |

### remove

```
synchronized public void remove(String name)
```

Removes a request property by name.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html name` | The name of the request property to remove. |

### set

```
synchronized public void set(Map<String, String> properties)
```

Sets the keys and values contained in the map. If a property previously existed, the old value is replaced by the specified value. If a property previously existed and is not in the map, the property is left unchanged.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/util/Map.html<https://developer.android.com/reference/java/lang/String.html, https://developer.android.com/reference/java/lang/String.html> properties` | The request properties. |

### set

```
synchronized public void set(String name, String value)
```

Sets the specified property `value` for the specified `name`. If a property for this name previously existed, the old value is replaced by the specified value.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html name` | The name of the request property. |
| `https://developer.android.com/reference/java/lang/String.html value` | The value of the request property. |