public final class S3Versions extends java.lang.Object implements java.lang.Iterable<S3VersionSummary>
for (S3VersionSummary summary : S3Versions.forPrefix(s3, "my-bucket", "photos/")) { System.out.printf("Version '%s' of key '%s'\n", summary.getVersionId(), summary.getKey()); }
The list of S3VersionSummary
s will be fetched lazily, a page at a
time, as they are needed. The size of the page can be controlled with the
withBatchSize(int)
method.
Modifier and Type | Method and Description |
---|---|
static S3Versions |
forKey(AmazonS3 s3,
java.lang.String bucketName,
java.lang.String key)
Constructs an iterable that covers the versions of a single Amazon S3
object.
|
java.lang.Integer |
getBatchSize() |
java.lang.String |
getBucketName() |
java.lang.String |
getKey() |
java.lang.String |
getPrefix() |
AmazonS3 |
getS3() |
static S3Versions |
inBucket(AmazonS3 s3,
java.lang.String bucketName)
Constructs an iterable that covers all the object versions in an Amazon
S3 bucket.
|
java.util.Iterator<S3VersionSummary> |
iterator() |
S3Versions |
withBatchSize(int batchSize)
Sets the batch size, i.e., how many
S3VersionSummary s will be
fetched at once. |
static S3Versions |
withPrefix(AmazonS3 s3,
java.lang.String bucketName,
java.lang.String prefix)
Constructs an iterable that covers the versions in an Amazon S3 bucket
where the object key begins with the given prefix.
|
public static S3Versions inBucket(AmazonS3 s3, java.lang.String bucketName)
s3
- The Amazon S3 client.bucketName
- The bucket name.public static S3Versions withPrefix(AmazonS3 s3, java.lang.String bucketName, java.lang.String prefix)
s3
- The Amazon S3 client.bucketName
- The bucket name.prefix
- The prefix.public static S3Versions forKey(AmazonS3 s3, java.lang.String bucketName, java.lang.String key)
s3
- The Amazon S3 client.bucketName
- The bucket name.key
- The key.public S3Versions withBatchSize(int batchSize)
S3VersionSummary
s will be
fetched at once.batchSize
- How many object summaries to fetch at once.public java.lang.Integer getBatchSize()
public java.lang.String getPrefix()
public java.lang.String getKey()
public AmazonS3 getS3()
public java.lang.String getBucketName()
public java.util.Iterator<S3VersionSummary> iterator()
iterator
in interface java.lang.Iterable<S3VersionSummary>
Copyright © 2018 Amazon Web Services, Inc. All Rights Reserved.