public static final class CosXmlServiceConfig.Builder
extends java.lang.Object
CosXmlServiceConfig
构造器和说明 |
---|
Builder() |
Builder(CosXmlServiceConfig config) |
限定符和类型 | 方法和说明 |
---|---|
CosXmlServiceConfig.Builder |
addHeader(java.lang.String key,
java.lang.String value)
给所有的请求统一添加 Header
|
CosXmlServiceConfig.Builder |
addNoSignHeaders(java.lang.String key) |
CosXmlServiceConfig |
builder() |
CosXmlServiceConfig.Builder |
dnsCache(boolean dnsCache)
是否开启 DNS 解析缓存,开启后,将 DNS 解析的结果缓存在本地,
当系统 DNS 解析失败后,会使用本地缓存的 DNS 结果
|
CosXmlServiceConfig.Builder |
enableQuic(boolean isEnable)
是否使能 Quic 协议,使能后,还需要额外引入 quic sdk 才能正常使用
|
CosXmlServiceConfig.Builder |
isHttps(boolean isHttps)
设置是否 Https 协议,默认为 Https
|
CosXmlServiceConfig.Builder |
setAccelerate(boolean accelerate)
是否使用全球加速域名
|
CosXmlServiceConfig.Builder |
setAppidAndRegion(java.lang.String appid,
java.lang.String region)
已过时。
|
CosXmlServiceConfig.Builder |
setBucketInPath(boolean bucketInPath)
已过时。
|
CosXmlServiceConfig.Builder |
setConnectionTimeout(int connectionTimeoutMills)
设置连接超时时间
|
CosXmlServiceConfig.Builder |
setDebuggable(boolean isDebuggable)
是否打印 Debug 日志
|
CosXmlServiceConfig.Builder |
setDownloadMaxThreadCount(int downloadMaxThreadCount)
设置下载时线程并发的最大值
|
CosXmlServiceConfig.Builder |
setEndpointSuffix(java.lang.String endpointSuffix)
已过时。
|
CosXmlServiceConfig.Builder |
setExecutor(java.util.concurrent.Executor excutor)
自定义线程池
|
CosXmlServiceConfig.Builder |
setHost(java.lang.String host)
设置除了 GetService 请求外的 host
|
CosXmlServiceConfig.Builder |
setHost(android.net.Uri uri)
设置除了 GetService 请求外的 Uri,用于解析 host、port 和 protocol
|
CosXmlServiceConfig.Builder |
setHostFormat(java.lang.String hostFormat)
设置 Host 的格式化字符串,sdk 会将 ${bucket} 替换为真正的 bucket,${region} 替换为真正的 region,
比如将 hostFormat 设置为 ${bucket}.
|
CosXmlServiceConfig.Builder |
setObserveExecutor(java.util.concurrent.Executor observeExecutor) |
CosXmlServiceConfig.Builder |
setPathStyle(boolean pathStyle)
设置 Bucket 参数在请求 Url 的 path 中,而是不 host 中,
比如 cos.ap-shanghai.myqcloud.com/1250000000-bucket/readMe.txt
|
CosXmlServiceConfig.Builder |
setPort(int port) |
CosXmlServiceConfig.Builder |
setRegion(java.lang.String region)
设置默认地域
|
CosXmlServiceConfig.Builder |
setRetryHandler(QCloudHttpRetryHandler qCloudHttpRetryHandler)
自定义重试策略
|
CosXmlServiceConfig.Builder |
setRetryStrategy(RetryStrategy retryStrategy)
自定义重试策略
|
CosXmlServiceConfig.Builder |
setSignInUrl(boolean signInUrl)
是否将签名放在 URL 中,默认放在 Header 中
|
CosXmlServiceConfig.Builder |
setSocketTimeout(int socketTimeoutMills)
设置 Socket 超时时间
|
CosXmlServiceConfig.Builder |
setTransferThreadControl(boolean transferThreadControl)
设置传输时是否进行线程并发控制
|
CosXmlServiceConfig.Builder |
setUploadMaxThreadCount(int uploadMaxThreadCount)
设置上传时线程并发的最大值
|
CosXmlServiceConfig.Builder |
setUserAgentExtended(java.lang.String userAgentExtended)
设置ua拓展参数
|
public Builder()
public Builder(CosXmlServiceConfig config)
public CosXmlServiceConfig.Builder setConnectionTimeout(int connectionTimeoutMills)
connectionTimeoutMills
- 超时时间public CosXmlServiceConfig.Builder setSocketTimeout(int socketTimeoutMills)
socketTimeoutMills
- 超时时间public CosXmlServiceConfig.Builder setTransferThreadControl(boolean transferThreadControl)
transferThreadControl
- 是否进行线程并发控制public CosXmlServiceConfig.Builder setUploadMaxThreadCount(int uploadMaxThreadCount)
uploadMaxThreadCount
- 线程并发的最大值public CosXmlServiceConfig.Builder setDownloadMaxThreadCount(int downloadMaxThreadCount)
downloadMaxThreadCount
- 线程并发的最大值public CosXmlServiceConfig.Builder isHttps(boolean isHttps)
isHttps
- 是否 Httpspublic CosXmlServiceConfig.Builder setHostFormat(java.lang.String hostFormat)
CosXmlBaseService.setDomain(String)
设置hostFormat
- host 格式化字符串@Deprecated public CosXmlServiceConfig.Builder setAppidAndRegion(java.lang.String appid, java.lang.String region)
setRegion(String)
来设置
存储桶的地域,后续的存储桶名称需要严格按照 bucketName-appid 的格式,否则会报存储桶不存在的错误,
这种方式下SDK 不会对您填写的存储桶名称做任何处理。appid
- appidregion
- 存储桶地域public CosXmlServiceConfig.Builder setRegion(java.lang.String region)
region
- 默认地域@Deprecated public CosXmlServiceConfig.Builder setEndpointSuffix(java.lang.String endpointSuffix)
setHostFormat(String)
方法endpointSuffix
- Host 的 suffixpublic CosXmlServiceConfig.Builder setHost(java.lang.String host)
host
- sdk 请求的 host,优先级比 hostFormat 更高public CosXmlServiceConfig.Builder setHost(android.net.Uri uri)
uri
- sdk 请求的地址,优先级比 hostFormat 更高public CosXmlServiceConfig.Builder setPort(int port)
public CosXmlServiceConfig.Builder setDebuggable(boolean isDebuggable)
isDebuggable
- 是否打印 Debug 日志public CosXmlServiceConfig.Builder setSignInUrl(boolean signInUrl)
signInUrl
- public CosXmlServiceConfig.Builder setRetryStrategy(RetryStrategy retryStrategy)
retryStrategy
- 重试策略public CosXmlServiceConfig.Builder setRetryHandler(QCloudHttpRetryHandler qCloudHttpRetryHandler)
qCloudHttpRetryHandler
- 重试策略@Deprecated public CosXmlServiceConfig.Builder setBucketInPath(boolean bucketInPath)
setPathStyle(boolean)
方法bucketInPath
- public CosXmlServiceConfig.Builder setPathStyle(boolean pathStyle)
pathStyle
- 参数是否在path中public CosXmlServiceConfig.Builder setExecutor(java.util.concurrent.Executor excutor)
excutor
- 线程池public CosXmlServiceConfig.Builder setObserveExecutor(java.util.concurrent.Executor observeExecutor)
public CosXmlServiceConfig.Builder enableQuic(boolean isEnable)
isEnable
- 是否使能public CosXmlServiceConfig.Builder setUserAgentExtended(java.lang.String userAgentExtended)
userAgentExtended
- ua拓展参数()会拼接在ua后面public CosXmlServiceConfig.Builder dnsCache(boolean dnsCache)
dnsCache
- 是否使能public CosXmlServiceConfig.Builder setAccelerate(boolean accelerate)
accelerate
- 是否加速public CosXmlServiceConfig builder()
public CosXmlServiceConfig.Builder addHeader(java.lang.String key, java.lang.String value)
key
- http header keyvalue
- http header valuepublic CosXmlServiceConfig.Builder addNoSignHeaders(java.lang.String key)