public interface Callback<T>
| 限定符和类型 | 字段和说明 |
|---|---|
static Callback |
EMPTY_CALLBACK
空实现
|
| 限定符和类型 | 方法和说明 |
|---|---|
DataHandler<T> |
getDataHandler()
获取数据处理器,用于解析转换响应结果
|
boolean |
onBefore(AbsHttpRequest httpRequest)
在请求前调用,在这里可以设置一些参数
|
void |
onComplete(okhttp3.Response response)
请求完成调用
|
void |
onError(okhttp3.Call call,
Exception exception)
请求失败调用
|
void |
onSuccess(T data)
|
void |
postProgress(long currentSize,
long totalSize,
float progress)
上传请求调用
|
static final Callback EMPTY_CALLBACK
boolean onBefore(AbsHttpRequest httpRequest)
httpRequest - 请求对象false则取消此次请求void postProgress(long currentSize,
long totalSize,
float progress)
currentSize - 当前上传的大小totalSize - 总的大小progress - 完成进度void onError(okhttp3.Call call,
Exception exception)
call - The real callexception - Exceptionvoid onComplete(okhttp3.Response response)
response - 原始的Response,方便调用者自行处理DataHandler<T> getDataHandler()
void onSuccess(T data)
data - 响应经过处理的数据getDataHandler()Copyright © 2017. All rights reserved.