桶(Bucket)是存储对象(Object)的容器。对象都隶属于桶。
以下代码用于创建桶:
public void testCreateBucket() {
try { if(s3.doesBucketExist(BUCKET_NAME)) { System.out.format("Bucket %s already exists.\n", BUCKET_NAME); } else { Bucket bucket = s3.createBucket(BUCKET_NAME); System.out.print(bucket.toString()); } } catch (AmazonServiceException e) { System.out.print("Create bucket faild, err :" + e); } } |