# UriCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/net/UriCompat.java+class:androidx.core.net.UriCompat) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

*** ** * ** ***


```
public final class UriCompat
```

<br />

*** ** * ** ***

Helper for accessing function in `https://developer.android.com/reference/android/net/Uri.html` in a backwards compatible fashion.

## Summary

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/core/net/UriCompat#toSafeString(android.net.Uri)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html uri)` Return a string representation of this URI that has common forms of PII redacted, making it safer to use for logging purposes. |

## Public methods

### toSafeString

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/core#1.2.0)

```
public static @NonNull String toSafeString(@NonNull Uri uri)
```

Return a string representation of this URI that has common forms of PII redacted, making it safer to use for logging purposes. For example, `tel:800-466-4411` is returned as `tel:xxx-xxx-xxxx` and `http://example.com/path/to/item/` is returned as `http://example.com/...`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html uri` | The uri for converted to string. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | Return a string representation of this URI that has common forms of PII redacted. |