本文整理汇总了Java中com.amazonaws.services.s3.iterable.S3Objects.inBucket方法的典型用法代码示例。如果您正苦于以下问题:Java S3Objects.inBucket方法的具体用法?Java S3Objects.inBucket怎么用?Java S3Objects.inBucket使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.s3.iterable.S3Objects
的用法示例。
在下文中一共展示了S3Objects.inBucket方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getObjectCount
import com.amazonaws.services.s3.iterable.S3Objects; //导入方法依赖的package包/类
private int getObjectCount(AmazonS3 s3Client, String bucket) {
int count = 0;
for(S3ObjectSummary ignored : S3Objects.inBucket(s3Client, bucket)) {
count++;
}
return count;
}
示例2: getObjectCount
import com.amazonaws.services.s3.iterable.S3Objects; //导入方法依赖的package包/类
private int getObjectCount(AmazonS3 s3Client, String bucket) {
int count = 0;
for(S3ObjectSummary s : S3Objects.inBucket(s3Client, bucket)) {
count++;
}
return count;
}
示例3: createBucket
import com.amazonaws.services.s3.iterable.S3Objects; //导入方法依赖的package包/类
public static void createBucket(AmazonS3 s3client, String bucketName) {
if(s3client.doesBucketExist(bucketName)) {
for(S3ObjectSummary s : S3Objects.inBucket(s3client, bucketName)) {
s3client.deleteObject(bucketName, s.getKey());
}
s3client.deleteBucket(bucketName);
}
Assert.assertFalse(s3client.doesBucketExist(bucketName));
// Note that CreateBucketRequest does not specify region. So bucket is
// bucketName
s3client.createBucket(new CreateBucketRequest(bucketName));
}
示例4: verifyAndReturnNoOfObjects
import com.amazonaws.services.s3.iterable.S3Objects; //导入方法依赖的package包/类
private int verifyAndReturnNoOfObjects() throws Exception {
int numberOfObjects = 0;
for (S3ObjectSummary s3ObjectSummary : S3Objects.inBucket(s3client, TARGET_BUCKET_NAME)) {
String fileNameOrKey = s3ObjectSummary.getKey();
if (withFileNamePrefix) {
//strip out the filePrefix sdc-
fileNameOrKey = fileNameOrKey.substring(4);
}
switch (source) {
case LOCAL:
verifyStreamCorrectness(
new FileInputStream(testDir.getAbsolutePath() + "/" + fileNameOrKey),
s3client.getObject(TARGET_BUCKET_NAME, s3ObjectSummary.getKey()).getObjectContent()
);
break;
case S3:
verifyStreamCorrectness(
s3client.getObject(SOURCE_BUCKET_NAME, fileNameOrKey).getObjectContent(),
s3client.getObject(TARGET_BUCKET_NAME, s3ObjectSummary.getKey()).getObjectContent()
);
break;
}
deleteObjectsAfterVerificationInTarget(s3ObjectSummary.getKey());
numberOfObjects++;
}
return numberOfObjects;
}