最近更新时间:2024-12-27 16:21:31
以下代码用于删除文件:
Ks3Client client = new Ks3Client("AccessKeyId", "SecretAccessKey", getApplicationContext());
client.setEndpoint("ks3-cn-beijing.ksyuncs.com");
DeleteObjectRequest request = new DeleteObjectRequest("bucketName", "objectKey");
client.deleteObject(request, new DeleteObjectResponseHandler() {
@Override
public void onSuccess(DeleteObjectRequest request, DeleteObjectResult result) {
Log.i("Delete Object", "Status Code: " + result.getStatusCode());
}
@Override
public void onFailure(DeleteObjectRequest request, Ks3ClientException clientException, Ks3ServiceException serviceException) {
if (clientException != null) {
Log.e("Delete Object", "ClientException: " + clientException.getMessage());
}
if (serviceException != null) {
Log.e("Delete Object", "ServiceException: " + serviceException.getMessage());
}
}
});
纯净模式