JvmFirmwareFileHandler

Constructors

Link copied to clipboard
constructor(client: HttpClient)

Functions

Link copied to clipboard
open suspend override fun checkUrlExists(url: String): Boolean

Return true if url is reachable (HTTP HEAD check).

Link copied to clipboard
open override fun cleanupAllTemporaryFiles()

Remove all temporary firmware files created during previous update sessions.

Link copied to clipboard
open suspend override fun copyToUri(source: FirmwareArtifact, destinationUri: CommonUri): Long

Copy source to the platform URI destinationUri, returning the number of bytes written.

Link copied to clipboard
open suspend override fun createDocumentInTree(treeUri: CommonUri, fileName: String, mimeType: String): CommonUri?

Creates fileName inside treeUri and returns a URI to write to, or null on failure.

Link copied to clipboard
open suspend override fun deleteFile(file: FirmwareArtifact)

Delete a single firmware file from local storage.

Link copied to clipboard
open suspend override fun downloadFile(url: String, fileName: String, onProgress: (Float) -> Unit): FirmwareArtifact?

Download a file from url, saving it as fileName in a temporary directory.

Link copied to clipboard
open suspend override fun extractFirmware(uri: CommonUri, hardware: DeviceHardware, fileExtension: String, preferredFilename: String? = null): FirmwareArtifact?

Extract a matching firmware binary from a platform URI (e.g. content:// or file://) zip archive.

Link copied to clipboard
open suspend override fun extractFirmwareFromZip(zipFile: FirmwareArtifact, hardware: DeviceHardware, fileExtension: String, preferredFilename: String? = null): FirmwareArtifact?

Extract a matching firmware binary from a previously-downloaded zip FirmwareArtifact.

Link copied to clipboard
open suspend override fun extractZipEntries(artifact: FirmwareArtifact): Map<String, ByteArray>

Fully expands artifact into memory, keyed by entry name.

Link copied to clipboard
open suspend override fun fetchText(url: String): String?

Fetch the UTF-8 text body of url, returning null on any HTTP or network error.

Link copied to clipboard
open suspend override fun getDisplayName(uri: CommonUri): String?

Resolve a user-visible display filename for uri, or null when the provider does not expose one.

Link copied to clipboard
open suspend override fun getFileSize(file: FirmwareArtifact): Long

Return the size in bytes of the given firmware file.

Link copied to clipboard
open suspend override fun importFromUri(uri: CommonUri): FirmwareArtifact?

Copy a platform URI into a temporary FirmwareArtifact so it can be read with readBytes. Returns null when the URI cannot be resolved.

Link copied to clipboard
open suspend override fun isDestinationReadable(destinationUri: CommonUri): Boolean

True when destinationUri can still be opened for reading.

Link copied to clipboard
open suspend override fun isRemovableDestination(destinationUri: CommonUri): Boolean

Always false on desktop: there is no Storage Access Framework to classify a volume with, and the multi-pass UF2 maintenance flow is Android-only. Refusing is the fail-closed answer, consistent with DesktopFirmwareUsbManager reporting the CDC unblock unsupported.

Link copied to clipboard
open suspend override fun readBytes(artifact: FirmwareArtifact): ByteArray

Read the raw bytes of a FirmwareArtifact.

Link copied to clipboard
open suspend override fun readSiblingText(treeUri: CommonUri, fileName: String): String?

Directory-based equivalents of the Android tree operations. Reachable only if a desktop maintenance flow is ever built — isRemovableDestination refuses first today — but implemented rather than stubbed so the behaviour is obvious to whoever gets there.