public final class PayloadTransferUpdate

  1. Object
  2. PayloadTransferUpdate

Progress on one payload, delivered to TransportListener.payloadProgress.

A byte payload typically produces a single update with PayloadStatus.SUCCESS; a file payload produces a stream of PayloadStatus.IN_PROGRESS updates and then a terminal one.

Constructors

public PayloadTransferUpdate(int payloadId, long bytesTransferred, long totalBytes, PayloadStatus status)Ports construct these.

Methods

public int getPayloadId()The payload this update is about, matching Payload.getId().
public long getBytesTransferred()How many bytes have moved so far.
public long getTotalBytes()The payload size, or -1 when the platform did not say.
public PayloadStatus getStatus()Where the transfer got to.
public String toString()Returns a string representation of the object.

Inherited methods

Constructor details

PayloadTransferUpdate

public PayloadTransferUpdate(int payloadId, long bytesTransferred, long totalBytes, PayloadStatus status)
Ports construct these.

Parameters

payloadId int
the payload this is about
bytesTransferred long
bytes moved so far
totalBytes long
the payload size, or -1 when unknown
status PayloadStatus
where the transfer got to

Method details

getPayloadId

public int getPayloadId()
The payload this update is about, matching Payload.getId().

getBytesTransferred

public long getBytesTransferred()
How many bytes have moved so far.

getTotalBytes

public long getTotalBytes()
The payload size, or -1 when the platform did not say. A stream payload legitimately has no total, so guard a progress bar on this being positive.

getStatus

public PayloadStatus getStatus()
Where the transfer got to. Never null.

toString

public String toString()
Returns a string representation of the object. In general, the toString method returns a string that “textually represents” this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method. The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@’, and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of: getClass().getName() + ‘@’ + Integer.toHexString(hashCode())