public class S3Versions extends Object implements 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,
String bucketName,
String key)
Constructs an iterable that covers the versions of a single Amazon S3
object.
|
Integer |
getBatchSize() |
String |
getBucketName() |
String |
getKey() |
String |
getPrefix() |
AmazonS3 |
getS3() |
static S3Versions |
inBucket(AmazonS3 s3,
String bucketName)
Constructs an iterable that covers all the object versions in an Amazon
S3 bucket.
|
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,
String bucketName,
String prefix)
Constructs an iterable that covers the versions in an Amazon S3 bucket
where the object key begins with the given prefix.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static S3Versions inBucket(AmazonS3 s3, String bucketName)
s3
- The Amazon S3 client.bucketName
- The bucket name.public static S3Versions withPrefix(AmazonS3 s3, String bucketName, String prefix)
s3
- The Amazon S3 client.bucketName
- The bucket name.prefix
- The prefix.public static S3Versions forKey(AmazonS3 s3, String bucketName, 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 Integer getBatchSize()
public String getPrefix()
public String getKey()
public AmazonS3 getS3()
public String getBucketName()
public Iterator<S3VersionSummary> iterator()
iterator
in interface Iterable<S3VersionSummary>
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.