API reference

DownloadHandle Class

Modifiers: final
Handle to an active or completed pak download. The 3p holds this to observe state transitions, cancel in-progress downloads, and compose via DownloadHandle.future.
Thread-safe. All methods may be called from any thread.

Signature

class DownloadHandle

Properties

future : CompletableFuture
[Get]
Future that completes with the validated File on success, or completes exceptionally with PakDownloadException on failure.
Signature
val future: CompletableFuture<File>
isCancelled : Boolean
[Get]
Signature
val isCancelled: Boolean
isTerminated : Boolean
[Get]
True once the handle has reached a terminal state (Ready or Failed).
Signature
val isTerminated: Boolean
onStateChanged : Function1?
[Get][Set]
Optional listener for state changes. Called on an unspecified background thread.
Note: the initial Idle -> Downloading transition fires synchronously inside PakDownloadManager.start before this handle is returned, so it cannot be observed via this listener — read DownloadHandle.state directly after start if you need the initial state.
Signature
var onStateChanged: (DownloadState) -> Unit?
request : DownloadRequest
[Get]
Signature
val request: DownloadRequest
[Get]
Signature
var state: DownloadState

Methods

cancel ()
Request cancellation. Idempotent. Transitions to Failed(Cancelled) if still in progress.
Signature
fun cancel()