public class Bucket extends Object implements Serializable
Represents an Amazon S3 bucket.
Every object stored in Amazon S3 is contained within a bucket. Buckets partition the namespace of objects stored in Amazon S3 at the top level. Within a bucket, any name can be used for objects. However, bucket names must be unique across all of Amazon S3.
Bucket ownership is similar to the ownership of Internet domain names. Within Amazon S3, only a single user owns each bucket. Once a uniquely named bucket is created in Amazon S3, organize and name the objects within the bucket in any way. Ownership of the bucket is retained as long as the owner has an Amazon S3 account.
To conform with DNS requirements, the following constraints apply:
There are no limits to the number of objects that can be stored in a bucket. Performance does not vary based on the number of buckets used. Store all objects within a single bucket or organize them across several buckets.
Constructor and Description |
---|
Bucket()
Constructs a bucket without any name specified.
|
Bucket(String name)
Creates a bucket with a name.
|
Modifier and Type | Method and Description |
---|---|
Date |
getCreationDate()
Gets the bucket's creation date.
|
String |
getName()
Gets the name of the bucket.
|
Owner |
getOwner()
Gets the bucket's owner.
|
String |
getRegion()
Gets the region where the bucket is located.
|
void |
setCreationDate(Date creationDate)
For internal use only.
|
void |
setName(String name)
Sets the name of the bucket.
|
void |
setOwner(Owner owner)
For internal use only.
|
void |
setRegion(String region)
Sets the region where the bucket is located.
|
String |
toString() |
public Bucket()
Bucket(String)
public String toString()
toString
in class Object
Object.toString()
public Owner getOwner()
null
if the bucket's owner is unknown.null
if it is unknown.setOwner(Owner)
public void setOwner(Owner owner)
owner
- The bucket's owner.getOwner()
public Date getCreationDate()
null
if the creation date is not known.null
if not known.public void setCreationDate(Date creationDate)
creationDate
- The bucket's creation date.public String getName()
setName(String)
public void setName(String name)
name
- The name for the bucket.public String getRegion()
null
for bucket instances created by the
AmazonS3.createBucket(CreateBucketRequest)
or
AmazonS3.createBucket(String)
API.public void setRegion(String region)
region
- The region for the bucket.