# AssetContentProvider

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

*** ** * ** ***


```
@UnstableApi
public final class AssetContentProvider extends ContentProvider implements ContentProvider.PipeDataWriter<Object>
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [android.content.ContentProvider](https://developer.android.com/reference/android/content/ContentProvider.html) ||
|   | ↳ | [androidx.media3.test.utils.AssetContentProvider](https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider) |

*** ** * ** ***

A `https://developer.android.com/reference/android/content/ContentProvider.html` for reading asset data.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#AssetContentProvider()()` |

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#buildUri(java.lang.String,java.lang.String,boolean)(https://developer.android.com/reference/java/lang/String.html authority, https://developer.android.com/reference/java/lang/String.html filePath, boolean pipeMode)` |
| `int` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#delete(android.net.Uri,java.lang.String,java.lang.String[])( https://developer.android.com/reference/android/net/Uri.html uri, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html selection, @https://developer.android.com/reference/androidx/annotation/Nullable String[] selectionArgs )` |
| `https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#getType(android.net.Uri)(https://developer.android.com/reference/android/net/Uri.html uri)` |
| `https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#insert(android.net.Uri,android.content.ContentValues)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/android/content/ContentValues.html values)` |
| `boolean` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#onCreate()()` |
| `@https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/res/AssetFileDescriptor.html` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#openAssetFile(android.net.Uri,java.lang.String)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mode)` |
| `https://developer.android.com/reference/android/database/Cursor.html` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#query(android.net.Uri,java.lang.String[],java.lang.String,java.lang.String[],java.lang.String)( https://developer.android.com/reference/android/net/Uri.html uri, @https://developer.android.com/reference/androidx/annotation/Nullable String[] projection, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html selection, @https://developer.android.com/reference/androidx/annotation/Nullable String[] selectionArgs, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html sortOrder )` |
| `int` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#update(android.net.Uri,android.content.ContentValues,java.lang.String,java.lang.String[])( https://developer.android.com/reference/android/net/Uri.html uri, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/content/ContentValues.html values, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/String.html selection, @https://developer.android.com/reference/androidx/annotation/Nullable String[] selectionArgs )` |
| `void` | `https://developer.android.com/reference/androidx/media3/test/utils/AssetContentProvider#writeDataToPipe(android.os.ParcelFileDescriptor,android.net.Uri,java.lang.String,android.os.Bundle,java.lang.Object)( https://developer.android.com/reference/android/os/ParcelFileDescriptor.html output, https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mimeType, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/android/os/Bundle.html opts, @https://developer.android.com/reference/androidx/annotation/Nullable https://developer.android.com/reference/java/lang/Object.html args )` |

### Inherited Constants

From [android.content.ComponentCallbacks2](https://developer.android.com/reference/android/content/ComponentCallbacks2.html) `static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_BACKGROUND = 40` `static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_COMPLETE = 80`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_MODERATE = 60`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_RUNNING_CRITICAL = 15`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_RUNNING_LOW = 10`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_RUNNING_MODERATE = 5`

**This field is deprecated.**
`static final int` `https://developer.android.com/reference/android/content/ComponentCallbacks2.html#TRIM_MEMORY_UI_HIDDEN = 20`

### Inherited methods

From [android.content.ContentProvider](https://developer.android.com/reference/android/content/ContentProvider.html) `ContentProviderResult[]` `https://developer.android.com/reference/android/content/ContentProvider.html#applyBatch(java.lang.String, java.util.ArrayList&lt;android.content.ContentProviderOperation&gt;)(
https://developer.android.com/reference/java/lang/String.html authority,
https://developer.android.com/reference/java/util/ArrayList.html<https://developer.android.com/reference/android/content/ContentProviderOperation.html> operations
)` `void` `https://developer.android.com/reference/android/content/ContentProvider.html#attachInfo(android.content.Context, android.content.pm.ProviderInfo)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/content/pm/ProviderInfo.html info)` `int` `https://developer.android.com/reference/android/content/ContentProvider.html#bulkInsert(android.net.Uri, android.content.ContentValues[])(https://developer.android.com/reference/android/net/Uri.html uri, ContentValues[] values)` `https://developer.android.com/reference/android/os/Bundle.html` `https://developer.android.com/reference/android/content/ContentProvider.html#call(java.lang.String, java.lang.String, android.os.Bundle)(https://developer.android.com/reference/java/lang/String.html method, https://developer.android.com/reference/java/lang/String.html arg, https://developer.android.com/reference/android/os/Bundle.html extras)` `https://developer.android.com/reference/android/net/Uri.html` `https://developer.android.com/reference/android/content/ContentProvider.html#canonicalize(android.net.Uri)(https://developer.android.com/reference/android/net/Uri.html url)` `final https://developer.android.com/reference/android/content/ContentProvider.CallingIdentity.html` `https://developer.android.com/reference/android/content/ContentProvider.html#clearCallingIdentity()()` `int` `https://developer.android.com/reference/android/content/ContentProvider.html#delete(android.net.Uri, android.os.Bundle)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/android/os/Bundle.html extras)` `void` `https://developer.android.com/reference/android/content/ContentProvider.html#dump(java.io.FileDescriptor, java.io.PrintWriter, java.lang.String[])(https://developer.android.com/reference/java/io/FileDescriptor.html fd, https://developer.android.com/reference/java/io/PrintWriter.html writer, String[] args)` `final https://developer.android.com/reference/android/content/AttributionSource.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getCallingAttributionSource()()` `final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getCallingAttributionTag()()` `final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getCallingPackage()()` `final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getCallingPackageUnchecked()()` `final https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getContext()()` `final PathPermission[]` `https://developer.android.com/reference/android/content/ContentProvider.html#getPathPermissions()()` `final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getReadPermission()()` `String[]` `https://developer.android.com/reference/android/content/ContentProvider.html#getStreamTypes(android.net.Uri, java.lang.String)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mimeTypeFilter)` `https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getTypeAnonymous(android.net.Uri)(https://developer.android.com/reference/android/net/Uri.html uri)` `final https://developer.android.com/reference/java/lang/String.html` `https://developer.android.com/reference/android/content/ContentProvider.html#getWritePermission()()` `boolean` `https://developer.android.com/reference/android/content/ContentProvider.html#isTemporary()()` `void` `https://developer.android.com/reference/android/content/ContentProvider.html#onCallingPackageChanged()()` `void` `https://developer.android.com/reference/android/content/ContentProvider.html#onConfigurationChanged(android.content.res.Configuration)(https://developer.android.com/reference/android/content/res/Configuration.html newConfig)` `void` `https://developer.android.com/reference/android/content/ContentProvider.html#onLowMemory()()`

**This method is deprecated.**
`void` `https://developer.android.com/reference/android/content/ContentProvider.html#onTrimMemory(int)(int level)` `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` `https://developer.android.com/reference/android/content/ContentProvider.html#openFile(android.net.Uri, java.lang.String)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mode)` `final https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` `https://developer.android.com/reference/android/content/ContentProvider.html#openFileHelper(android.net.Uri, java.lang.String)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mode)` `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` `<T> https://developer.android.com/reference/android/content/ContentProvider.html#openPipeHelper(android.net.Uri, java.lang.String, android.os.Bundle, T, android.content.ContentProvider.PipeDataWriter&lt;T&gt;)(
https://developer.android.com/reference/android/net/Uri.html uri,
https://developer.android.com/reference/java/lang/String.html mimeType,
https://developer.android.com/reference/android/os/Bundle.html opts,
T args,
https://developer.android.com/reference/android/content/ContentProvider.PipeDataWriter.html<T> func
)` `https://developer.android.com/reference/android/content/res/AssetFileDescriptor.html` `https://developer.android.com/reference/android/content/ContentProvider.html#openTypedAssetFile(android.net.Uri, java.lang.String, android.os.Bundle)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/java/lang/String.html mimeTypeFilter, https://developer.android.com/reference/android/os/Bundle.html opts)` `https://developer.android.com/reference/android/database/Cursor.html` `https://developer.android.com/reference/android/content/ContentProvider.html#query(android.net.Uri, java.lang.String[], android.os.Bundle, android.os.CancellationSignal)(
https://developer.android.com/reference/android/net/Uri.html uri,
String[] projection,
https://developer.android.com/reference/android/os/Bundle.html queryArgs,
https://developer.android.com/reference/android/os/CancellationSignal.html cancellationSignal
)` `boolean` `https://developer.android.com/reference/android/content/ContentProvider.html#refresh(android.net.Uri, android.os.Bundle, android.os.CancellationSignal)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/android/os/Bundle.html extras, https://developer.android.com/reference/android/os/CancellationSignal.html cancellationSignal)` `final https://developer.android.com/reference/android/content/Context.html` `https://developer.android.com/reference/android/content/ContentProvider.html#requireContext()()` `final void` `https://developer.android.com/reference/android/content/ContentProvider.html#restoreCallingIdentity(android.content.ContentProvider.CallingIdentity)(https://developer.android.com/reference/android/content/ContentProvider.CallingIdentity.html identity)` `final void` `https://developer.android.com/reference/android/content/ContentProvider.html#setPathPermissions(android.content.pm.PathPermission[])(PathPermission[] permissions)` `final void` `https://developer.android.com/reference/android/content/ContentProvider.html#setReadPermission(java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission)` `final void` `https://developer.android.com/reference/android/content/ContentProvider.html#setWritePermission(java.lang.String)(https://developer.android.com/reference/java/lang/String.html permission)` `void` `https://developer.android.com/reference/android/content/ContentProvider.html#shutdown()()` `https://developer.android.com/reference/android/net/Uri.html` `https://developer.android.com/reference/android/content/ContentProvider.html#uncanonicalize(android.net.Uri)(https://developer.android.com/reference/android/net/Uri.html url)` `int` `https://developer.android.com/reference/android/content/ContentProvider.html#update(android.net.Uri, android.content.ContentValues, android.os.Bundle)(https://developer.android.com/reference/android/net/Uri.html uri, https://developer.android.com/reference/android/content/ContentValues.html values, https://developer.android.com/reference/android/os/Bundle.html extras)`

## Public constructors

### AssetContentProvider

```
public AssetContentProvider()
```

## Public methods

### buildUri

```
public static Uri buildUri(String authority, String filePath, boolean pipeMode)
```

### delete

```
public int delete(
    Uri uri,
    @Nullable String selection,
    @Nullable String[] selectionArgs
)
```

### getType

```
public String getType(Uri uri)
```

### insert

```
public Uri insert(Uri uri, ContentValues values)
```

### onCreate

```
public boolean onCreate()
```

### openAssetFile

```
public @Nullable AssetFileDescriptor openAssetFile(Uri uri, String mode)
```

| Throws |
|---|---|
| `https://developer.android.com/reference/java/io/FileNotFoundException.html` |   |

### query

```
public Cursor query(
    Uri uri,
    @Nullable String[] projection,
    @Nullable String selection,
    @Nullable String[] selectionArgs,
    @Nullable String sortOrder
)
```

### update

```
public int update(
    Uri uri,
    @Nullable ContentValues values,
    @Nullable String selection,
    @Nullable String[] selectionArgs
)
```

### writeDataToPipe

```
public void writeDataToPipe(
    ParcelFileDescriptor output,
    Uri uri,
    String mimeType,
    @Nullable Bundle opts,
    @Nullable Object args
)
```