# AppSearchBlobHandle

Artifact: [androidx.appsearch:appsearch](https://developer.android.com/jetpack/androidx/releases/appsearch) [View Source](https://cs.android.com/search?q=file:androidx/appsearch/app/AppSearchBlobHandle.java+class:androidx.appsearch.app.AppSearchBlobHandle) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appsearch#1.1.0)

*** ** * ** ***

<br />

```
class AppSearchBlobHandle
```

<br />

*** ** * ** ***

An identifier to represent a blob in AppSearch.

A "blob" is a large binary object. It is used to store a significant amount of data that is not searchable, such as images, videos, audio files, or other binary data. Unlike other fields in AppSearch, blobs are stored as blob files on disk rather than in memory, and use `https://developer.android.com/reference/android/os/ParcelFileDescriptor.html` to read and write. This allows for efficient handling of large, non-searchable content.

`https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` is a light-weight `Property` of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument`, which is a pointer to the heavy-weight blob data.

The blob data could be written via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#openBlobForWriteAsync(java.util.Set<androidx.appsearch.app.AppSearchBlobHandle>)` and read via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession#openBlobForReadAsync(java.util.Set<androidx.appsearch.app.AppSearchBlobHandle>)`.

A `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` with `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle``Property` could be put and read without the large blob data. This offers lazy retrieval to blob data when searching `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument` in AppSearch.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/GenericDocument.Builder#setPropertyBlobHandle(java.lang.String,androidx.appsearch.app.AppSearchBlobHandle...)` |   |

## Summary

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#createWithSha256(byte[],java.lang.String,java.lang.String,java.lang.String)( digest: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>, packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, databaseName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html, namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html )` Create a new AppSearch blob identifier with given digest, package, database and namespace. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#equals(java.lang.Object)(o: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#getDatabaseName()()` Returns the name of database stored the blob that this object is representing. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#getNamespace()()` Returns the app-defined namespace this blob resides in. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#getPackageName()()` Returns the package name indicating the owner app of the blob that this object is representing. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#getSha256Digest()()` Returns the SHA-256 hash of the blob that this object is representing. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle#toString()()` |

## Public functions

### createWithSha256

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

```
java-static fun createWithSha256(
    digest: ByteArray<Byte>,
    packageName: String,
    databaseName: String,
    namespace: String
): AppSearchBlobHandle
```

Create a new AppSearch blob identifier with given digest, package, database and namespace.

The package name and database name indicated where this blob will be stored. To write, commit or read this blob via `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession`, it must match the package name and database name of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchSession`.

For two objects of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` to be considered equal, the `packageName`, `database`, `namespace` and `digest` must be equal.

| Parameters |
|---|---|
| `digest: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>` | The SHA-256 hash of the blob this is representing. |
| `packageName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The package name of the owner of this Blob. |
| `databaseName: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The database name of this blob to stored into. |
| `namespace: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | The namespace of this blob resides in. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` | a new instance of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` object. |

### equals

```
fun equals(o: Any?): Boolean
```

### getDatabaseName

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

```
fun getDatabaseName(): String
```

Returns the name of database stored the blob that this object is representing.

For two objects of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` to be considered equal, the `packageName`, `database`, `namespace` and `digest` must be equal.

### getNamespace

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

```
fun getNamespace(): String
```

Returns the app-defined namespace this blob resides in.

For two objects of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` to be considered equal, the `packageName`, `database`, `namespace` and `digest` must be equal.

### getPackageName

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

```
fun getPackageName(): String
```

Returns the package name indicating the owner app of the blob that this object is representing.

For two objects of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` to be considered equal, the `packageName`, `database`, `namespace` and `digest` must be equal.

### getSha256Digest

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

```
fun getSha256Digest(): Array<Byte>
```

Returns the SHA-256 hash of the blob that this object is representing.

For two objects of `https://developer.android.com/reference/kotlin/androidx/appsearch/app/AppSearchBlobHandle` to be considered equal, the `packageName`, `database`, `namespace` and `digest` must be equal.

### hashCode

```
fun hashCode(): Int
```

### toString

```
fun toString(): String
```