CustomModel

public class CustomModel


Stores information about custom models that are being downloaded or are already downloaded on a device. In the case where an update is available, after the updated model file is fully downloaded, the original model file will be removed once it is safe to do so.

Summary

Public fields

final long
final String
final long
final String
final String
final String

Public methods

boolean
long

The download ID (returns 0 if no download in progress), which can be used with the Android DownloadManager to query download progress.

@Nullable File

The local model file.

@NonNull String

Retrieves the model hash.

@NonNull String

Retrieves the model name and identifier.

long

The size of the file currently associated with this model.

int
@NonNull String

Public fields

downloadId

public final long downloadId

downloadUrl

public final String downloadUrl

downloadUrlExpiry

public final long downloadUrlExpiry

localFilePath

public final String localFilePath

modelHash

public final String modelHash

name

public final String name

Public methods

equals

public boolean equals(Object o)

getDownloadId

public long getDownloadId()

The download ID (returns 0 if no download in progress), which can be used with the Android DownloadManager to query download progress. The retrieved progress information can be used to populate a progress bar, monitor when an updated model is available, etc.

Returns
long

The download ID (if download in progress), otherwise returns 0.

getFile

public @Nullable File getFile()

The local model file. If null is returned, use the download ID to check the download status.

Returns
@Nullable File

The local file associated with the model. If the original file download is still in progress, returns null. If a file update is in progress, returns the last fully downloaded model.

getModelHash

public @NonNull String getModelHash()

Retrieves the model hash.

Returns
@NonNull String

The model hash

getName

public @NonNull String getName()

Retrieves the model name and identifier.

Returns
@NonNull String

The name of the model.

getSize

public long getSize()

The size of the file currently associated with this model. If a download is in progress, this will be the size of the current model, not the new model currently being downloaded.

Returns
long

The local model size.

hashCode

public int hashCode()

toString

public @NonNull String toString()

Extension functions

ModelDownloaderKt.component1

public final File ModelDownloaderKt.component1(@NonNull CustomModel receiver)

ModelDownloaderKt.component1

public final File ModelDownloaderKt.component1(@NonNull CustomModel receiver)

ModelDownloaderKt.component2

public final long ModelDownloaderKt.component2(@NonNull CustomModel receiver)

ModelDownloaderKt.component2

public final long ModelDownloaderKt.component2(@NonNull CustomModel receiver)

ModelDownloaderKt.component3

public final long ModelDownloaderKt.component3(@NonNull CustomModel receiver)

ModelDownloaderKt.component3

public final long ModelDownloaderKt.component3(@NonNull CustomModel receiver)

ModelDownloaderKt.component4

public final @NonNull String ModelDownloaderKt.component4(@NonNull CustomModel receiver)

ModelDownloaderKt.component4

public final @NonNull String ModelDownloaderKt.component4(@NonNull CustomModel receiver)

ModelDownloaderKt.component5

public final @NonNull String ModelDownloaderKt.component5(@NonNull CustomModel receiver)

ModelDownloaderKt.component5

public final @NonNull String ModelDownloaderKt.component5(@NonNull CustomModel receiver)