AndroidDownloadableModelFileDownloader

internal class AndroidDownloadableModelFileDownloader(val fileProviderDescriptor: FileProviderDescriptor, val networkUsageRepository: NetworkUsageRepository) : DownloadableModelFileDownloader(source)

Downloads local model archives into Android app-private storage and reports real downloaded bytes.

Author

Dmitriy Moroz

Parameters

fileProviderDescriptor

Provides the app-private local model directory path.

networkUsageRepository

Persists downloaded byte deltas for network usage statistics.

Throws

when OkHttp returns a non-successful download response.

Constructors

Link copied to clipboard
constructor(fileProviderDescriptor: FileProviderDescriptor, networkUsageRepository: NetworkUsageRepository)

Types

Link copied to clipboard
private object Companion

Download constants and client factory scoped to this downloader.

Properties

Link copied to clipboard

Provides the app-private local model directory path.

Link copied to clipboard
private val httpClient: OkHttpClient

Long-running OkHttp client used for model archive downloads.

Link copied to clipboard

Persists downloaded byte deltas for network usage statistics.

Functions

Link copied to clipboard
open override fun download(id: String, url: String): Flow<DownloadState>

Downloads a local model archive, unpacks zip files, and emits progress states.

Link copied to clipboard
private suspend fun downloadToFile(url: String, destination: File, onProgress: suspend (Int) -> Unit): File

Streams a remote model file to disk and records the exact received byte count.

Link copied to clipboard
private fun getDestinationPath(id: String, url: String): String

Resolves the concrete file path used before optional zip extraction.