# UrlTemplate

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

*** ** * ** ***


```
@UnstableApi
public final class UrlTemplate
```

<br />

*** ** * ** ***

A template from which URLs can be built.

URLs are built according to the substitution rules defined in ISO/IEC 23009-1:2014 5.3.9.4.4.

## Summary

| ### Public methods |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/UrlTemplate#buildUri(java.lang.String,long,int,long)( https://developer.android.com/reference/java/lang/String.html representationId, long segmentNumber, int bandwidth, long time )` Constructs a Uri from the template, substituting in the provided arguments. |
| `static https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/UrlTemplate` | `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/UrlTemplate#compile(java.lang.String)(https://developer.android.com/reference/java/lang/String.html template)` Compile an instance from the provided template string. |

## Public methods

### buildUri

```
public String buildUri(
    String representationId,
    long segmentNumber,
    int bandwidth,
    long time
)
```

Constructs a Uri from the template, substituting in the provided arguments.

Arguments whose corresponding identifiers are not present in the template will be ignored.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html representationId` | The representation identifier. |
| `long segmentNumber` | The segment number. |
| `int bandwidth` | The bandwidth. |
| `long time` | The time as specified by the segment timeline. |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html` | The built Uri. |

### compile

```
public static UrlTemplate compile(String template)
```

Compile an instance from the provided template string.

| Parameters |
|---|---|
| `https://developer.android.com/reference/java/lang/String.html template` | The template. |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/media3/exoplayer/dash/manifest/UrlTemplate` | The compiled instance. |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | If the template string is malformed. |