AppSearchSession.OpenBlobForWrite Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Opens a batch of AppSearch Blobs for writing.
[Android.Runtime.Register("openBlobForWrite", "(Ljava/util/Set;Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)V", "", ApiSince=36)]
public void OpenBlobForWrite(System.Collections.Generic.ICollection<Android.App.AppSearch.AppSearchBlobHandle> handles, Java.Util.Concurrent.IExecutor executor, Java.Util.Functions.IConsumer callback);
[<Android.Runtime.Register("openBlobForWrite", "(Ljava/util/Set;Ljava/util/concurrent/Executor;Ljava/util/function/Consumer;)V", "", ApiSince=36)>]
member this.OpenBlobForWrite : System.Collections.Generic.ICollection<Android.App.AppSearch.AppSearchBlobHandle> * Java.Util.Concurrent.IExecutor * Java.Util.Functions.IConsumer -> unit
Parameters
- handles
- ICollection<AppSearchBlobHandle>
The AppSearchBlobHandle
s that identifies the blobs.
- executor
- IExecutor
Executor on which to invoke the callback.
- callback
- IConsumer
Callback to receive the OpenBlobForWriteResponse
.
- Attributes
Remarks
Opens a batch of AppSearch Blobs for writing.
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.
Once done writing, call #commitBlob
to commit blob files.
This call will create a empty blob file for each given AppSearchBlobHandle
, and a android.os.ParcelFileDescriptor
of that blob file will be returned in the OpenBlobForWriteResponse
.
If the blob file is already stored in AppSearch and committed. A failed AppSearchResult
with error code AppSearchResult#RESULT_ALREADY_EXISTS
will be associated with the AppSearchBlobHandle
.
If the blob file is already stored in AppSearch but not committed. A android.os.ParcelFileDescriptor
of that blob file will be returned for continue writing.
For given duplicate AppSearchBlobHandle
, the same android.os.ParcelFileDescriptor
pointing to the same blob file will be returned.
Pending blob files won't be lost or auto-commit if AppSearchSession
closed. Pending blob files will be stored in disk rather than memory. You can re-open AppSearchSession
and re-write the pending blob files.
A committed blob file will be considered as an orphan if no GenericDocument
references it. Uncommitted pending blob files and orphan blobs files will be cleaned up if they has been created for an extended period (default is 1 week).
The returned OpenBlobForWriteResponse
must be closed after use to avoid resource leaks. Failing to close it will result in system file descriptor exhaustion.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.