目录

TransferStateUpdate

Class Info

public final class TransferStateUpdate implements Parcelable

数据传输状态更新类。描述一个正在传输的数据传输状态,接收或者发送。通过onTransferUpdate(String, TransferStateUpdate)方法通知应用。

Nested Class Summary

Qualifier and Type

Class Name and Description

@interface

TransferStateUpdate.Status

数据传输时,每次的更新状态。

Public Field Summary

Qualifier and Type

Field and Description

static final Parcelable.Creator<TransferStateUpdate>

CREATOR

实现Parcelable接口必须提供的实例。

Public Constructor Summary

Constructor Name

public TransferStateUpdate(int status, long dataId, long totalBytes, long bytesTransferred)

创建一个数据传输状态更新类。

Public Method Summary

Qualifier and Type

Method Name and Description

int

describeContents()

返回当前Parcelable对象描述。

boolean

equals(Object other)

判断其他对象是否与本实例相同。

long

getBytesTransferred()

获取已传输字节数。

long

getDataId()

获取数据标识。

int

getStatus()

获取传输状态。

long

getTotalBytes()

获取数据总字节数。

int

hashCode()

获取哈希值。

void

writeToParcel(Parcel dest, int flags)

把值写入dest Parcel。

Public Fields

[h2]CREATOR

Fields

public static final Parcelable.Creator<TransferStateUpdate> CREATOR

实现Parcelable接口必须提供的实例。

Public Methods

[h2]describeContents

Method

public int describeContents()

返回当前Parcelable对象描述。

Returns

Type

Description

int

返回当前Parcelable对象描述。返回值如下:

  • 0:普通Parcelable对象。
  • 1:包含文件描述符的Parcelable对象。

[h2]equals

Method

public boolean equals(Object other)

判断其他对象是否与本实例相同。

Parameters

Name

Description

other

其他对象。

Returns

Type

Description

boolean

  • true:相同。
  • false:不相同。

[h2]getBytesTransferred

Method

public long getBytesTransferred()

获取已传输字节数。

Returns

Type

Description

long

已传输字节数。

[h2]getDataId

Method

public long getDataId()

获取数据标识。

Returns

Type

Description

long

数据标识。

[h2]getStatus

Method

public int getStatus()

获取传输状态。具体传输状态参见TransferStateUpdate.Status。

Returns

Type

Description

int

传输状态。

[h2]getTotalBytes

Method

public long getTotalBytes()

获取数据总字节数。由于STREAM数据类型无法获知流的总长度,一直返回-1,表示未知总长度。

Returns

Type

Description

long

数据总字节数。

[h2]hashCode

Method

public int hashCode()

获取哈希值。

Returns

Type

Description

int

当前对象的哈希值。

[h2]writeToParcel

Method

public void writeToParcel(Parcel dest, int flags)

把值写入dest Parcel。

Parameters

Name

Description

dest

对象被写入的Parcel。

flags

写入方式,取值如下:

  • 0。
  • PARCELABLE_WRITE_RETURN_VALUE(详情查看Parcelable接口类)。

Public Constructors

[h2]TransferStateUpdate

Constructor

public TransferStateUpdate(int status, long dataId, long totalBytes, long bytesTransferred)

创建一个数据传输状态更新实例。

Parameters

Name

Description

status

传输状态。

dataId

当前传输的数据标识。

totalBytes

当前传输的总字节数。

bytesTransferred

截止当前传输成功的字节数。