public class CosXmlBaseService extends java.lang.Object implements BaseCosXml
更详细的使用方式请参考:入门文档
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
appCachePath |
static java.lang.String |
BRIDGE
桥接来源
|
protected QCloudHttpClient |
client |
protected CosXmlServiceConfig |
config |
protected QCloudCredentialProvider |
credentialProvider |
static boolean |
IS_CLOSE_BEACON
是否关闭灯塔上报
|
protected java.lang.String |
requestDomain |
protected QCloudSelfSigner |
selfSigner |
protected java.lang.String |
signerType |
protected java.lang.String |
tag |
构造器和说明 |
---|
CosXmlBaseService(android.content.Context context,
CosXmlServiceConfig configuration)
cos android SDK 服务
|
CosXmlBaseService(android.content.Context context,
CosXmlServiceConfig configuration,
QCloudCredentialProvider qCloudCredentialProvider)
cos android SDK 服务
|
CosXmlBaseService(android.content.Context context,
CosXmlServiceConfig configuration,
QCloudSelfSigner selfSigner)
cos android SDK 服务
|
CosXmlBaseService(android.content.Context context,
CosXmlServiceConfig configuration,
QCloudSigner qCloudSigner)
cos android SDK 服务
|
限定符和类型 | 方法和说明 |
---|---|
void |
addCustomerDNS(java.lang.String domainName,
java.lang.String[] ipList)
自定义 DNS 解析
|
void |
addCustomerDNSFetch(QCloudHttpClient.QCloudDnsFetch dnsFetch)
添加自定义 DNS 解析器
支持添加多个,会顺序解析获取
|
void |
addVerifiedHost(java.lang.String hostName)
已过时。
|
BasePutObjectResult |
basePutObject(BasePutObjectRequest request)
基础简单上传的同步方法.
|
void |
basePutObjectAsync(BasePutObjectRequest request,
CosXmlResultListener cosXmlResultListener)
基础简单上传的异步方法.
|
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> |
buildHttpRequest(T1 cosXmlRequest,
T2 cosXmlResult)
构建请求
Header 数据优先级:request、config、默认
|
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> |
buildHttpRequestBodyConverter(T1 cosXmlRequest,
T2 cosXmlResult,
QCloudHttpRequest.Builder<T2> httpRequestBuilder) |
void |
cancel(CosXmlRequest cosXmlRequest)
取消请求任务.
|
void |
cancelAll()
取消所有的请求任务.
|
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> |
execute(T1 cosXmlRequest,
T2 cosXmlResult)
同步执行
|
java.lang.String |
getAccessUrl(CosXmlRequest cosXmlRequest)
获取请求的访问地址
|
java.lang.String |
getAppid()
已过时。
|
CosXmlServiceConfig |
getConfig() |
QCloudCredentialProvider |
getCredentialProvider() |
java.io.File[] |
getLogFiles(int limit)
获取 SDK 日志信息
|
GetObjectResult |
getObject(GetObjectRequest request)
获取 COS 对象的同步方法.
|
byte[] |
getObject(java.lang.String bucketName,
java.lang.String objectName)
将 COS 对象下载为字节数组
详细介绍,请查看:
BaseCosXml.getObject(String, String) |
void |
getObjectAsync(GetObjectRequest request,
CosXmlResultListener cosXmlResultListener)
获取 COS 对象的异步方法.
|
java.lang.String |
getObjectUrl(java.lang.String bucket,
java.lang.String region,
java.lang.String key)
获取对象的 url 地址
|
java.lang.String |
getPresignedURL(CosXmlRequest cosXmlRequest)
获取预签名文件URL
|
java.lang.String |
getRegion()
已过时。
|
java.lang.String |
getRegion(CosXmlRequest cosXmlRequest)
已过时。
|
protected java.lang.String |
getRequestHost(CosXmlRequest request) |
void |
release()
释放所有的请求.
|
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> |
schedule(T1 cosXmlRequest,
T2 cosXmlResult,
CosXmlResultListener cosXmlResultListener)
异步执行
|
protected <T1 extends CosXmlRequest> |
setCopySource(T1 cosXmlRequest) |
void |
setDomain(java.lang.String domain)
设置除 get service 请求外其他所有请求的域名
|
void |
setNetworkClient(CosXmlServiceConfig configuration) |
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> |
setProgressListener(T1 cosXmlRequest,
HttpTask<T2> httpTask,
boolean isSchedule) |
protected java.lang.String |
signerTypeCompat(java.lang.String signerType,
CosXmlRequest cosXmlRequest)
兼容某些request的signerType(比如SensitiveContentRecognitionRequest应该是cos 而不是ci)
|
UploadPartResult |
uploadPart(UploadPartRequest request)
上传一个对象某个分片块的同步方法.
|
void |
uploadPartAsync(UploadPartRequest request,
CosXmlResultListener cosXmlResultListener)
上传一个对象某个分片块的异步方法.
|
public static boolean IS_CLOSE_BEACON
public static java.lang.String BRIDGE
protected volatile QCloudHttpClient client
protected QCloudCredentialProvider credentialProvider
protected java.lang.String tag
protected java.lang.String signerType
protected CosXmlServiceConfig config
public static java.lang.String appCachePath
protected java.lang.String requestDomain
protected QCloudSelfSigner selfSigner
public CosXmlBaseService(android.content.Context context, CosXmlServiceConfig configuration, QCloudCredentialProvider qCloudCredentialProvider)
context
- Application 上下文Application
configuration
- cos android SDK 服务配置CosXmlServiceConfig
qCloudCredentialProvider
- cos android SDK 证书提供者 QCloudCredentialProvider
public CosXmlBaseService(android.content.Context context, CosXmlServiceConfig configuration)
context
- Application 上下文Application
configuration
- cos android SDK 服务配置CosXmlServiceConfig
public CosXmlBaseService(android.content.Context context, CosXmlServiceConfig configuration, QCloudSigner qCloudSigner)
context
- Application 上下文Application
configuration
- cos android SDK 服务配置 CosXmlServiceConfig
qCloudSigner
- cos android SDK 签名提供者 QCloudSigner
public CosXmlBaseService(android.content.Context context, CosXmlServiceConfig configuration, QCloudSelfSigner selfSigner)
context
- Application 上下文Application
configuration
- cos android SDK 服务配置 CosXmlServiceConfig
selfSigner
- cos android SDK 签名提供者 QCloudSelfSigner
public QCloudCredentialProvider getCredentialProvider()
protected java.lang.String signerTypeCompat(java.lang.String signerType, CosXmlRequest cosXmlRequest)
public void setNetworkClient(CosXmlServiceConfig configuration)
public void addCustomerDNS(java.lang.String domainName, java.lang.String[] ipList) throws CosXmlClientException
domainName
- dns 解析的 domainipList
- 解析的 ip 地址列表CosXmlClientException
- 客户端异常public void addCustomerDNSFetch(@NonNull QCloudHttpClient.QCloudDnsFetch dnsFetch)
dnsFetch
- DNS 解析器@Deprecated public void addVerifiedHost(java.lang.String hostName)
public void setDomain(java.lang.String domain)
domain
- 域名protected java.lang.String getRequestHost(CosXmlRequest request) throws CosXmlClientException
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> QCloudHttpRequest buildHttpRequest(T1 cosXmlRequest, T2 cosXmlResult) throws CosXmlClientException
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> boolean buildHttpRequestBodyConverter(T1 cosXmlRequest, T2 cosXmlResult, QCloudHttpRequest.Builder<T2> httpRequestBuilder)
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> T2 execute(T1 cosXmlRequest, T2 cosXmlResult) throws CosXmlClientException, CosXmlServiceException
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> void schedule(T1 cosXmlRequest, T2 cosXmlResult, CosXmlResultListener cosXmlResultListener)
protected <T1 extends CosXmlRequest> void setCopySource(T1 cosXmlRequest) throws CosXmlClientException
protected <T1 extends CosXmlRequest,T2 extends CosXmlResult> void setProgressListener(T1 cosXmlRequest, HttpTask<T2> httpTask, boolean isSchedule)
public java.lang.String getAccessUrl(CosXmlRequest cosXmlRequest)
cosXmlRequest
- 请求public java.lang.String getPresignedURL(CosXmlRequest cosXmlRequest) throws CosXmlClientException
cosXmlRequest
- 请求CosXmlClientException
- 客户端异常public GetObjectResult getObject(GetObjectRequest request) throws CosXmlClientException, CosXmlServiceException
获取 COS 对象的同步方法.
getObject
在接口中 BaseCosXml
request
- 获取 COS 对象的请求 GetObjectRequest
GetObjectResult
CosXmlClientException
- 客户端异常CosXmlServiceException
- 服务端异常public void getObjectAsync(GetObjectRequest request, CosXmlResultListener cosXmlResultListener)
获取 COS 对象的异步方法.
详细介绍,请查看:BaseCosXml.getObjectAsync(GetObjectRequest, CosXmlResultListener)
getObjectAsync
在接口中 BaseCosXml
request
- 获取 COS 对象的请求 GetObjectRequest
cosXmlResultListener
- 请求回调结果 CosXmlResultListener
public byte[] getObject(java.lang.String bucketName, java.lang.String objectName) throws CosXmlClientException, CosXmlServiceException
将 COS 对象下载为字节数组
详细介绍,请查看:BaseCosXml.getObject(String, String)
getObject
在接口中 BaseCosXml
bucketName
- 存储桶名称objectName
- 对象远端路径,即存储到 COS 上的绝对路径CosXmlClientException
- 客户端异常CosXmlServiceException
- 服务端异常public BasePutObjectResult basePutObject(BasePutObjectRequest request) throws CosXmlClientException, CosXmlServiceException
基础简单上传的同步方法.
basePutObject
在接口中 BaseCosXml
request
- 简单上传请求 BasePutObjectRequest
BasePutObjectResult
CosXmlClientException
- 客户端异常CosXmlServiceException
- 服务端异常public void basePutObjectAsync(BasePutObjectRequest request, CosXmlResultListener cosXmlResultListener)
基础简单上传的异步方法.
详细介绍,请查看:BaseCosXml.basePutObjectAsync(BasePutObjectRequest, CosXmlResultListener)
basePutObjectAsync
在接口中 BaseCosXml
request
- 简单上传请求 BasePutObjectRequest
cosXmlResultListener
- 请求回调结果 CosXmlResultListener
public UploadPartResult uploadPart(UploadPartRequest request) throws CosXmlClientException, CosXmlServiceException
上传一个对象某个分片块的同步方法.
uploadPart
在接口中 BaseCosXml
request
- 上传一个对象某个分块请求 UploadPartRequest
UploadPartResult
CosXmlClientException
- 客户端异常CosXmlServiceException
- 服务端异常public void uploadPartAsync(UploadPartRequest request, CosXmlResultListener cosXmlResultListener)
上传一个对象某个分片块的异步方法.
详细介绍,请查看:BaseCosXml.uploadPartAsync(UploadPartRequest, CosXmlResultListener)
uploadPartAsync
在接口中 BaseCosXml
request
- 上传某个分块请求 UploadPartRequest
cosXmlResultListener
- 请求回调结果 CosXmlResultListener
public java.lang.String getObjectUrl(java.lang.String bucket, java.lang.String region, java.lang.String key)
BaseCosXml
getObjectUrl
在接口中 BaseCosXml
public void cancel(CosXmlRequest cosXmlRequest)
BaseCosXml.cancel(CosXmlRequest)
cancel
在接口中 BaseCosXml
cosXmlRequest
- 请求request CosXmlRequest
public void cancelAll()
BaseCosXml.cancelAll()
cancelAll
在接口中 BaseCosXml
public void release()
BaseCosXml.release()
release
在接口中 BaseCosXml
@Deprecated public java.lang.String getAppid()
@Deprecated public java.lang.String getRegion()
@Deprecated public java.lang.String getRegion(CosXmlRequest cosXmlRequest)
public CosXmlServiceConfig getConfig()
public java.io.File[] getLogFiles(int limit)