判断桶是否存在
您可以使用 doesBucketExist 接口判断桶是否存在,以下代码展示如何判断一个桶是否存在:
String bucketName = "<your-bucket-name>";
boolean exists = s3.doesBucketExistV2(bucketName);
if (exists) {
System.out.format("Bucket %s already exists.\n", bucketName);
}
您可以使用 doesBucketExist 接口判断桶是否存在,以下代码展示如何判断一个桶是否存在:
String bucketName = "<your-bucket-name>";
boolean exists = s3.doesBucketExistV2(bucketName);
if (exists) {
System.out.format("Bucket %s already exists.\n", bucketName);
}