AppSearchBlobHandle
@ExperimentalAppSearchApi
public final class AppSearchBlobHandle
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 android.os.ParcelFileDescriptor to read and write. This allows for efficient handling of large, non-searchable content.
AppSearchBlobHandle is a light-weight Property of GenericDocument, which is a pointer to the heavy-weight blob data.
The blob data could be written via openBlobForWriteAsync and read via openBlobForReadAsync.
A GenericDocument with AppSearchBlobHandleProperty could be put and read without the large blob data. This offers lazy retrieval to blob data when searching GenericDocument in AppSearch.
| See also | |
|---|---|
setPropertyBlobHandle |
Summary
Public methods |
|
|---|---|
static @NonNull AppSearchBlobHandle |
createWithSha256(Create a new AppSearch blob identifier with given digest, package, database and namespace. |
boolean |
|
@NonNull String |
Returns the name of database stored the blob that this object is representing. |
@NonNull String |
Returns the app-defined namespace this blob resides in. |
@NonNull String |
Returns the package name indicating the owner app of the blob that this object is representing. |
@NonNull byte[] |
Returns the SHA-256 hash of the blob that this object is representing. |
int |
hashCode() |
@NonNull String |
toString() |
Public methods
createWithSha256
public static @NonNull AppSearchBlobHandle createWithSha256(
@NonNull byte[] digest,
@NonNull String packageName,
@NonNull String databaseName,
@NonNull String namespace
)
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 AppSearchSession, it must match the package name and database name of AppSearchSession.
For two objects of AppSearchBlobHandle to be considered equal, the packageName, database, namespace and digest must be equal.
| Parameters | |
|---|---|
@NonNull byte[] digest |
The SHA-256 hash of the blob this is representing. |
@NonNull String packageName |
The package name of the owner of this Blob. |
@NonNull String databaseName |
The database name of this blob to stored into. |
@NonNull String namespace |
The namespace of this blob resides in. |
| Returns | |
|---|---|
@NonNull AppSearchBlobHandle |
a new instance of |
getDatabaseName
public @NonNull String getDatabaseName()
Returns the name of database stored the blob that this object is representing.
For two objects of AppSearchBlobHandle to be considered equal, the packageName, database, namespace and digest must be equal.
getNamespace
public @NonNull String getNamespace()
Returns the app-defined namespace this blob resides in.
For two objects of AppSearchBlobHandle to be considered equal, the packageName, database, namespace and digest must be equal.
getPackageName
public @NonNull String getPackageName()
Returns the package name indicating the owner app of the blob that this object is representing.
For two objects of AppSearchBlobHandle to be considered equal, the packageName, database, namespace and digest must be equal.
getSha256Digest
public @NonNull byte[] getSha256Digest()
Returns the SHA-256 hash of the blob that this object is representing.
For two objects of AppSearchBlobHandle to be considered equal, the packageName, database, namespace and digest must be equal.