public class S3Objects extends Object implements Iterable<S3ObjectSummary>
for ( S3ObjectSummary summary : S3Objects.withPrefix(s3, "my-bucket", "photos/") ) { System.out.printf("Object with key '%s'\n", summary.getKey()); }
The list of S3ObjectSummary
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 |
---|---|
Integer |
getBatchSize() |
String |
getBucketName() |
String |
getDelimiter() |
String |
getEncodingType() |
String |
getMarker() |
String |
getPrefix() |
AmazonS3 |
getS3() |
static S3Objects |
inBucket(AmazonS3 s3,
String bucketName)
Constructs an iterable that covers all the objects in an Amazon S3
bucket.
|
boolean |
isRequesterPays() |
Iterator<S3ObjectSummary> |
iterator() |
S3Objects |
withBatchSize(int batchSize)
Sets the batch size, i.e., how many
S3ObjectSummary s will be
fetched at once. |
void |
withDelimiter(String delimiter) |
void |
withEncodingType(String encodingType) |
void |
withMarker(String marker) |
static S3Objects |
withPrefix(AmazonS3 s3,
String bucketName,
String prefix)
Constructs an iterable that covers the objects in an Amazon S3 bucket
where the key begins with the given prefix.
|
void |
withRequesterPays(boolean requesterPays) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public static S3Objects inBucket(AmazonS3 s3, String bucketName)
s3
- The Amazon S3 client.bucketName
- The bucket name.public static S3Objects withPrefix(AmazonS3 s3, String bucketName, String prefix)
s3
- The Amazon S3 client.bucketName
- The bucket name.prefix
- The prefix.public S3Objects withBatchSize(int batchSize)
S3ObjectSummary
s will be
fetched at once.batchSize
- How many object summaries to fetch at once.public void withRequesterPays(boolean requesterPays)
public void withEncodingType(String encodingType)
public void withMarker(String marker)
ListObjectsRequest.withMarker(String)
public void withDelimiter(String delimiter)
ListObjectsRequest.withDelimiter(String)
public Integer getBatchSize()
public String getPrefix()
public String getBucketName()
public String getDelimiter()
public String getMarker()
public String getEncodingType()
public boolean isRequesterPays()
public AmazonS3 getS3()
public Iterator<S3ObjectSummary> iterator()
iterator
in interface Iterable<S3ObjectSummary>
Copyright © 2013 Amazon Web Services, Inc. All Rights Reserved.