public class OSSUtils
extends java.lang.Object
构造器和说明 |
---|
OSSUtils() |
限定符和类型 | 方法和说明 |
---|---|
static void |
addDateHeader(java.util.Map<java.lang.String,java.lang.String> headers,
java.lang.String header,
java.util.Date value) |
static void |
addHeader(java.util.Map<java.lang.String,java.lang.String> headers,
java.lang.String header,
java.lang.String value) |
static void |
addStringListHeader(java.util.Map<java.lang.String,java.lang.String> headers,
java.lang.String header,
java.util.List<java.lang.String> values) |
static void |
assertTrue(boolean condition,
java.lang.String message) |
static java.lang.String |
buildBaseLogInfo(Context context) |
static java.lang.String |
buildCanonicalizedResource(java.lang.String resourcePath,
java.util.Map<java.lang.String,java.lang.String> parameters) |
static java.lang.String |
buildCanonicalizedResource(java.lang.String bucketName,
java.lang.String objectKey,
java.util.Map<java.lang.String,java.lang.String> parameters) |
static java.lang.String |
buildCanonicalString(RequestMessage request) |
static java.lang.String |
buildImagePersistentBody(java.lang.String toBucketName,
java.lang.String toObjectKey,
java.lang.String action) |
static java.lang.String |
buildTriggerCallbackBody(java.util.Map<java.lang.String,java.lang.String> callbackParams,
java.util.Map<java.lang.String,java.lang.String> callbackVars) |
static java.lang.String |
buildXMLFromPartEtagList(java.util.List<PartETag> partETagList) |
static void |
checkChecksum(java.lang.Long clientChecksum,
java.lang.Long serverChecksum,
java.lang.String requestId)
Checks if OSS and SDK's checksum is same.
|
static boolean |
checkParamRange(long param,
long from,
boolean leftInclusive,
long to,
boolean rightInclusive) |
static java.lang.String |
determineContentType(java.lang.String initValue,
java.lang.String srcPath,
java.lang.String toObjectKey) |
static boolean |
doesBucketNameValid(OSSRequest request) |
static boolean |
doesRequestNeedObjectKey(OSSRequest request) |
static void |
ensureBucketNameValid(java.lang.String bucketName) |
static void |
ensureObjectKeyValid(java.lang.String objectKey) |
static void |
ensureRequestValid(OSSRequest request,
RequestMessage message) |
static boolean |
isCname(java.lang.String host)
判断一个域名是否是cname
|
static boolean |
isEmptyString(java.lang.String str)
判断一个字符串是否为空
|
static boolean |
isInCustomCnameExcludeList(java.lang.String endpoint,
java.util.List<java.lang.String> customCnameExludeList)
判断一个域名是否在自定义Cname排除列表之中
|
static boolean |
isOssOriginHost(java.lang.String host) |
static boolean |
isValidateIP(java.lang.String host) |
static java.lang.String |
join(java.util.List<java.lang.String> strings) |
static java.lang.String |
paramToQueryString(java.util.Map<java.lang.String,java.lang.String> params,
java.lang.String charset)
Encode request parameters to URL segment.
|
static void |
populateCopyObjectHeaders(CopyObjectRequest copyObjectRequest,
java.util.Map<java.lang.String,java.lang.String> headers) |
static void |
populateListBucketRequestParameters(ListBucketsRequest listBucketsRequest,
java.util.Map<java.lang.String,java.lang.String> params) |
static void |
populateListMultipartUploadsRequestParameters(ListMultipartUploadsRequest request,
java.util.Map<java.lang.String,java.lang.String> params) |
static void |
populateListObjectsRequestParameters(ListObjectsRequest listObjectsRequest,
java.util.Map<java.lang.String,java.lang.String> params) |
static java.lang.String |
populateMapToBase64JsonString(java.util.Map<java.lang.String,java.lang.String> map) |
static void |
populateRequestMetadata(java.util.Map<java.lang.String,java.lang.String> headers,
ObjectMetadata metadata)
Populate metadata to headers.
|
static void |
removeHeader(java.util.Map<java.lang.String,java.lang.String> headers,
java.lang.String header) |
static java.lang.String |
sign(java.lang.String accessKey,
java.lang.String screctKey,
java.lang.String content)
根据ak/sk、content生成token
|
static void |
signRequest(RequestMessage message) |
static boolean |
validateBucketName(java.lang.String bucketName)
校验bucketName的合法性
|
static boolean |
validateObjectKey(java.lang.String objectKey)
校验objectKey的合法性
|
public static void populateRequestMetadata(java.util.Map<java.lang.String,java.lang.String> headers, ObjectMetadata metadata)
public static void populateListBucketRequestParameters(ListBucketsRequest listBucketsRequest, java.util.Map<java.lang.String,java.lang.String> params)
public static void populateListObjectsRequestParameters(ListObjectsRequest listObjectsRequest, java.util.Map<java.lang.String,java.lang.String> params)
public static void populateListMultipartUploadsRequestParameters(ListMultipartUploadsRequest request, java.util.Map<java.lang.String,java.lang.String> params)
public static boolean checkParamRange(long param, long from, boolean leftInclusive, long to, boolean rightInclusive)
public static void populateCopyObjectHeaders(CopyObjectRequest copyObjectRequest, java.util.Map<java.lang.String,java.lang.String> headers)
public static java.lang.String buildXMLFromPartEtagList(java.util.List<PartETag> partETagList)
public static void addHeader(java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String header, java.lang.String value)
public static void addDateHeader(java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String header, java.util.Date value)
public static void addStringListHeader(java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String header, java.util.List<java.lang.String> values)
public static void removeHeader(java.util.Map<java.lang.String,java.lang.String> headers, java.lang.String header)
public static java.lang.String join(java.util.List<java.lang.String> strings)
public static boolean isEmptyString(java.lang.String str)
str
- public static java.lang.String buildCanonicalString(RequestMessage request)
public static java.lang.String buildCanonicalizedResource(java.lang.String bucketName, java.lang.String objectKey, java.util.Map<java.lang.String,java.lang.String> parameters)
public static java.lang.String buildCanonicalizedResource(java.lang.String resourcePath, java.util.Map<java.lang.String,java.lang.String> parameters)
public static java.lang.String paramToQueryString(java.util.Map<java.lang.String,java.lang.String> params, java.lang.String charset)
public static java.lang.String populateMapToBase64JsonString(java.util.Map<java.lang.String,java.lang.String> map)
public static java.lang.String sign(java.lang.String accessKey, java.lang.String screctKey, java.lang.String content)
accessKey
- screctKey
- content
- public static boolean isOssOriginHost(java.lang.String host)
public static boolean isCname(java.lang.String host)
public static boolean isInCustomCnameExcludeList(java.lang.String endpoint, java.util.List<java.lang.String> customCnameExludeList)
public static void assertTrue(boolean condition, java.lang.String message)
public static boolean validateBucketName(java.lang.String bucketName)
bucketName
- public static void ensureBucketNameValid(java.lang.String bucketName)
public static boolean validateObjectKey(java.lang.String objectKey)
objectKey
- public static void ensureObjectKeyValid(java.lang.String objectKey)
public static boolean doesRequestNeedObjectKey(OSSRequest request)
public static boolean doesBucketNameValid(OSSRequest request)
public static void ensureRequestValid(OSSRequest request, RequestMessage message)
public static java.lang.String determineContentType(java.lang.String initValue, java.lang.String srcPath, java.lang.String toObjectKey)
public static void signRequest(RequestMessage message) throws java.lang.Exception
java.lang.Exception
public static java.lang.String buildBaseLogInfo(Context context)
public static void checkChecksum(java.lang.Long clientChecksum, java.lang.Long serverChecksum, java.lang.String requestId) throws InconsistentException
public static boolean isValidateIP(java.lang.String host) throws java.lang.Exception
host
- java.lang.Exception
public static java.lang.String buildTriggerCallbackBody(java.util.Map<java.lang.String,java.lang.String> callbackParams, java.util.Map<java.lang.String,java.lang.String> callbackVars)
public static java.lang.String buildImagePersistentBody(java.lang.String toBucketName, java.lang.String toObjectKey, java.lang.String action)