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 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.

@NullableFile

The local model file.

@NonNullString

Retrieves the model hash.

@NonNullString

Retrieves the model name and identifier.

long

The size of the file currently associated with this model.

int
@NonNullString

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 @NullableFile getFile()

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

Returns
@NullableFile

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 @NonNullString getModelHash()

Retrieves the model hash.

Returns
@NonNullString

The model hash

getName

public @NonNullString getName()

Retrieves the model name and identifier.

Returns
@NonNullString

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 @NonNullString toString()

Extension functions

ModelDownloaderKt.component1

public final File ModelDownloaderKt.component1(@NonNullCustomModel receiver)

ModelDownloaderKt.component1

public final File ModelDownloaderKt.component1(@NonNullCustomModel receiver)

ModelDownloaderKt.component2

public final long ModelDownloaderKt.component2(@NonNullCustomModel receiver)

ModelDownloaderKt.component2

public final long ModelDownloaderKt.component2(@NonNullCustomModel receiver)

ModelDownloaderKt.component3

public final long ModelDownloaderKt.component3(@NonNullCustomModel receiver)

ModelDownloaderKt.component3

public final long ModelDownloaderKt.component3(@NonNullCustomModel receiver)

ModelDownloaderKt.component4

public final @NonNullString ModelDownloaderKt.component4(@NonNullCustomModel receiver)

ModelDownloaderKt.component4

public final @NonNullString ModelDownloaderKt.component4(@NonNullCustomModel receiver)

ModelDownloaderKt.component5

public final @NonNullString ModelDownloaderKt.component5(@NonNullCustomModel receiver)

ModelDownloaderKt.component5

public final @NonNullString ModelDownloaderKt.component5(@NonNullCustomModel receiver)