DataSourceContractTest.FakeTransferListener


public class DataSourceContractTest.FakeTransferListener implements TransferListener


A TransferListener that only keeps track of the transferred bytes.

Summary

Public constructors

Public methods

void
onBytesTransferred(
    DataSource source,
    DataSpec dataSpec,
    boolean isNetwork,
    int bytesTransferred
)

Called incrementally during a transfer.

void
onTransferEnd(DataSource source, DataSpec dataSpec, boolean isNetwork)

Called when a transfer ends.

void
onTransferInitializing(
    DataSource source,
    DataSpec dataSpec,
    boolean isNetwork
)

Called when a transfer is being initialized.

void
onTransferStart(DataSource source, DataSpec dataSpec, boolean isNetwork)

Called when a transfer starts.

Public constructors

FakeTransferListener

public FakeTransferListener()

Public methods

onBytesTransferred

public void onBytesTransferred(
    DataSource source,
    DataSpec dataSpec,
    boolean isNetwork,
    int bytesTransferred
)

Called incrementally during a transfer.

Parameters
DataSource source

The source performing the transfer.

DataSpec dataSpec

Describes the data being transferred.

boolean isNetwork

Whether the data is transferred through a network.

int bytesTransferred

The number of bytes transferred since the previous call to this method.

onTransferEnd

public void onTransferEnd(DataSource source, DataSpec dataSpec, boolean isNetwork)

Called when a transfer ends.

Parameters
DataSource source

The source performing the transfer.

DataSpec dataSpec

Describes the data being transferred.

boolean isNetwork

Whether the data is transferred through a network.

onTransferInitializing

public void onTransferInitializing(
    DataSource source,
    DataSpec dataSpec,
    boolean isNetwork
)

Called when a transfer is being initialized.

Parameters
DataSource source

The source performing the transfer.

DataSpec dataSpec

Describes the data for which the transfer is initialized.

boolean isNetwork

Whether the data is transferred through a network.

onTransferStart

public void onTransferStart(DataSource source, DataSpec dataSpec, boolean isNetwork)

Called when a transfer starts.

Parameters
DataSource source

The source performing the transfer.

DataSpec dataSpec

Describes the data being transferred.

boolean isNetwork

Whether the data is transferred through a network.