String bucket = "examplebucket-1250000000"; //存储桶名称,格式:BucketName-APPIDString cosPath = "exampleobject"; //对象位于存储桶中的位置标识符,即对象键String savePath = context.getExternalCacheDir().toString(); //本地路径GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, cosPath,savePath);getObjectRequest.addQuery("imageMogr2/thumbnail/!50p", null);cosXmlService.getObjectAsync(getObjectRequest, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest cosXmlRequest,CosXmlResult cosXmlResult) {GetObjectResult getObjectResult = (GetObjectResult) cosXmlResult;}// 如果您使用 kotlin 语言来调用,请注意回调方法中的异常是可空的,否则不会回调 onFail 方法,即:// clientException 的类型为 CosXmlClientException?,serviceException 的类型为 CosXmlServiceException?@Overridepublic void onFail(CosXmlRequest cosXmlRequest,@Nullable CosXmlClientException clientException,@Nullable CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
String bucket = "examplebucket-1250000000"; //存储桶名称,格式:BucketName-APPIDString cosPath = "exampleobject"; //对象位于存储桶中的位置标识符,即对象键String savePath = context.getExternalCacheDir().toString(); //本地路径GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, cosPath,savePath);getObjectRequest.addQuery("imageMogr2/iradius/150", null);cosXmlService.getObjectAsync(getObjectRequest, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest cosXmlRequest,CosXmlResult cosXmlResult) {GetObjectResult getObjectResult = (GetObjectResult) cosXmlResult;}// 如果您使用 kotlin 语言来调用,请注意回调方法中的异常是可空的,否则不会回调 onFail 方法,即:// clientException 的类型为 CosXmlClientException?,serviceException 的类型为 CosXmlServiceException?@Overridepublic void onFail(CosXmlRequest cosXmlRequest,@Nullable CosXmlClientException clientException,@Nullable CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
String bucket = "examplebucket-1250000000"; //存储桶名称,格式:BucketName-APPIDString cosPath = "exampleobject"; //对象位于存储桶中的位置标识符,即对象键String savePath = context.getExternalCacheDir().toString(); //本地路径GetObjectRequest getObjectRequest = new GetObjectRequest(bucket, cosPath,savePath);getObjectRequest.addQuery("imageMogr2/rotate/90", null);cosXmlService.getObjectAsync(getObjectRequest, new CosXmlResultListener() {@Overridepublic void onSuccess(CosXmlRequest cosXmlRequest,CosXmlResult cosXmlResult) {GetObjectResult getObjectResult = (GetObjectResult) cosXmlResult;}// 如果您使用 kotlin 语言来调用,请注意回调方法中的异常是可空的,否则不会回调 onFail 方法,即:// clientException 的类型为 CosXmlClientException?,serviceException 的类型为 CosXmlServiceException?@Overridepublic void onFail(CosXmlRequest cosXmlRequest,@Nullable CosXmlClientException clientException,@Nullable CosXmlServiceException serviceException) {if (clientException != null) {clientException.printStackTrace();} else {serviceException.printStackTrace();}}});
本页内容是否解决了您的问题?