|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.amazonaws.services.s3.iterable.S3Versions
public class S3Versions
Provides an easy way to iterate Amazon S3 object versions in a "foreach" statement. For example:
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.
Method Summary | |
---|---|
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. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
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>
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |