# Class PayloadTransferUpdate

java.lang.Object
com.codename1.nearby.transport.PayloadTransferUpdate

public final class PayloadTransferUpdate extends Object

Progress on one payload, delivered to `TransportListener.payloadProgress(Endpoint, PayloadTransferUpdate)`.

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.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PayloadTransferUpdate(int payloadId, long bytesTransferred, long totalBytes, PayloadStatus status)`
  Ports construct these.

- ## Method Summary

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

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### PayloadTransferUpdate

    public PayloadTransferUpdate(int payloadId, long bytesTransferred, long totalBytes, PayloadStatus status)

    Ports construct these.

    ###### Parameters

    - `payloadId`: the payload this is about
    - `bytesTransferred`: bytes moved so far
    - `totalBytes`: the payload size, or -1 when unknown
    - `status`: 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()
    Description copied from class: `Object`
    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())
    Overrides:
      `toString` in class `Object`