TransferListener
@UnstableApi
interface TransferListener
DataSourceContractTest.FakeTransferListener |
A |
DefaultBandwidthMeter |
Estimates bandwidth by listening to data transfers. |
ExperimentalBandwidthMeter |
An experimental |
A listener of data transfer events.
A transfer usually progresses through multiple steps:
- Initializing the underlying resource (e.g. opening a HTTP connection).
onTransferInitializingis called before the initialization starts. - Starting the transfer after successfully initializing the resource.
onTransferStartis called. Note that this only happens if the initialization was successful. - Transferring data.
onBytesTransferredis called frequently during the transfer to indicate progress. - Closing the transfer and the underlying resource.
onTransferEndis called. Note that eachonTransferStartwill have exactly one corresponding call toonTransferEnd.
Summary
Public functions |
|
|---|---|
Unit |
onBytesTransferred(Called incrementally during a transfer. |
Unit |
onTransferEnd(source: DataSource!, dataSpec: DataSpec!, isNetwork: Boolean)Called when a transfer ends. |
Unit |
onTransferInitializing(Called when a transfer is being initialized. |
Unit |
onTransferStart(source: DataSource!, dataSpec: DataSpec!, isNetwork: Boolean)Called when a transfer starts. |
Public functions
onBytesTransferred
fun onBytesTransferred(
source: DataSource!,
dataSpec: DataSpec!,
isNetwork: Boolean,
bytesTransferred: Int
): Unit
Called incrementally during a transfer.
| Parameters | |
|---|---|
source: DataSource! |
The source performing the transfer. |
dataSpec: DataSpec! |
Describes the data being transferred. |
isNetwork: Boolean |
Whether the data is transferred through a network. |
bytesTransferred: Int |
The number of bytes transferred since the previous call to this method. |
onTransferEnd
fun onTransferEnd(source: DataSource!, dataSpec: DataSpec!, isNetwork: Boolean): Unit
Called when a transfer ends.
| Parameters | |
|---|---|
source: DataSource! |
The source performing the transfer. |
dataSpec: DataSpec! |
Describes the data being transferred. |
isNetwork: Boolean |
Whether the data is transferred through a network. |
onTransferInitializing
fun onTransferInitializing(
source: DataSource!,
dataSpec: DataSpec!,
isNetwork: Boolean
): Unit
Called when a transfer is being initialized.
| Parameters | |
|---|---|
source: DataSource! |
The source performing the transfer. |
dataSpec: DataSpec! |
Describes the data for which the transfer is initialized. |
isNetwork: Boolean |
Whether the data is transferred through a network. |
onTransferStart
fun onTransferStart(source: DataSource!, dataSpec: DataSpec!, isNetwork: Boolean): Unit
Called when a transfer starts.
| Parameters | |
|---|---|
source: DataSource! |
The source performing the transfer. |
dataSpec: DataSpec! |
Describes the data being transferred. |
isNetwork: Boolean |
Whether the data is transferred through a network. |