public static MultiPageImageCaptureScenario.PageStorage
API for implementing a custom image storage.
Most common scenarios will work with the default page storage. PageStorage interface is intended for advanced users and specific scenarios.
PageStorage can be represented as a collection of pages, where each page is assigned with a unique identifier (GUID) and is itself a key-value collection with string keys and arbitrary data values (byte[]/NSData). Key-value relationship is to be maintained on the client side. An example of a key is an image or a thumbnail.
The default implementation of the PageStorage is file-based. By default it has a root folder located in application's internal storage. Each page is stored in a subfolder of the root folder named with page's identifier. All page-related data, such as captured image and its properties, is stored in files inside the corresponding subfolder.
Methods can be used for creation and managing pages of the image storage.
This logic is also used in the custom image storage implementation with the PageStorage interface and its methods.
To use the implemented custom storage instead of the default one, use the corresponding Builder.
This interface and its methods are to be implemented on the client side.
@WorkerThread @NotNull java.lang.String create()
Creates an empty page with a string identifier and adds it to the storage.
@WorkerThread void delete(@NotNull java.lang.String pageId)
Removes the page with specified identifier
pageId
- Identifier of the page to be removed.@WorkerThread @NotNull java.util.List<java.lang.String> getPages()
Returns all the pages identifiers in the storage.
@WorkerThread void store(@NotNull java.lang.String pageId, @NotNull java.lang.String key, @Nullable kotlin.Array[] data)
Adds, removes or edits data, associated with the key of the page with the specified identifier.
pageId
- Identifier of the page with certain data. Must not be nullkey
- The key, associated with the data to be edited. Must not be null.data
- Exact data to be added to the page by the key. Pass null to remove the stored value.@WorkerThread @Nullable kotlin.Array[] load(@NotNull java.lang.String pageId, @NotNull java.lang.String key)
Returns the data of the certain page, associated with the specified key
pageId
- Identifier of the page with certain data.key
- The key, associated with the data to be edited@WorkerThread void clear()
Removes all the pages from the storage.