当前位置: 首页>>代码示例>>Java>>正文


Java ObjectListing.setPrefix方法代码示例

本文整理汇总了Java中com.amazonaws.services.s3.model.ObjectListing.setPrefix方法的典型用法代码示例。如果您正苦于以下问题:Java ObjectListing.setPrefix方法的具体用法?Java ObjectListing.setPrefix怎么用?Java ObjectListing.setPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.amazonaws.services.s3.model.ObjectListing的用法示例。


在下文中一共展示了ObjectListing.setPrefix方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: listNextBatchOfObjects

import com.amazonaws.services.s3.model.ObjectListing; //导入方法依赖的package包/类
@Override
public ObjectListing listNextBatchOfObjects(ListNextBatchOfObjectsRequest listNextBatchOfObjectsRequest)
        throws SdkClientException, AmazonServiceException {
    listNextBatchOfObjectsRequest = beforeClientExecution(listNextBatchOfObjectsRequest);
    rejectNull(listNextBatchOfObjectsRequest,
            "The request object parameter must be specified when listing the next batch of objects in a bucket");
    ObjectListing previousObjectListing = listNextBatchOfObjectsRequest.getPreviousObjectListing();

    if (!previousObjectListing.isTruncated()) {
        ObjectListing emptyListing = new ObjectListing();
        emptyListing.setBucketName(previousObjectListing.getBucketName());
        emptyListing.setDelimiter(previousObjectListing.getDelimiter());
        emptyListing.setMarker(previousObjectListing.getNextMarker());
        emptyListing.setMaxKeys(previousObjectListing.getMaxKeys());
        emptyListing.setPrefix(previousObjectListing.getPrefix());
        emptyListing.setEncodingType(previousObjectListing.getEncodingType());
        emptyListing.setTruncated(false);

        return emptyListing;
    }
    return listObjects(listNextBatchOfObjectsRequest.toListObjectsRequest());
}
 
开发者ID:IBM,项目名称:ibm-cos-sdk-java,代码行数:23,代码来源:AmazonS3Client.java

示例2: objectListingAnswer

import com.amazonaws.services.s3.model.ObjectListing; //导入方法依赖的package包/类
private Answer<ObjectListing> objectListingAnswer(@Nullable final String marker, final String... fileNames) {
    return new Answer<ObjectListing>() {
        @Override
        public ObjectListing answer(InvocationOnMock invocation)
                throws Throwable {
            ListObjectsRequest request = (ListObjectsRequest) invocation.getArguments()[0];

            ObjectListing objectListing = new ObjectListing();
            objectListing.setBucketName(request.getBucketName());
            objectListing.setPrefix(request.getPrefix());

            objectListing.setTruncated(marker != null);
            objectListing.setNextMarker(marker);

            for (String fileName : fileNames) {
                S3ObjectSummary objectSummary = new S3ObjectSummary();
                objectSummary.setKey(request.getPrefix() + fileName);
                objectSummary.setSize(100);
                objectListing.getObjectSummaries().add(objectSummary);
            }

            return objectListing;
        }
    };
}
 
开发者ID:bazaarvoice,项目名称:emodb,代码行数:26,代码来源:StashReaderTest.java

示例3: listObjects

import com.amazonaws.services.s3.model.ObjectListing; //导入方法依赖的package包/类
@Override
public ObjectListing listObjects(ListObjectsRequest request) throws AmazonClientException, AmazonServiceException {
    int currentRequestCount = requestCount.incrementAndGet();
    
    assertEquals("mycamelbucket", request.getBucketName());
    if (currentRequestCount == 2) {
        assertEquals("confidential", request.getPrefix());
    }
    
    ObjectListing response = new ObjectListing();
    response.setBucketName(request.getBucketName());
    response.setPrefix(request.getPrefix());

    S3ObjectSummary s3ObjectSummary = new S3ObjectSummary();
    s3ObjectSummary.setBucketName(request.getBucketName());
    s3ObjectSummary.setKey("key");
    response.getObjectSummaries().add(s3ObjectSummary);
    
    return response;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:S3IncludeBodyTest.java

示例4: listNextBatchOfObjects

import com.amazonaws.services.s3.model.ObjectListing; //导入方法依赖的package包/类
public void listNextBatchOfObjects(ObjectListing objectListing, Subscriber<ObjectListing> observable) {
    if (!objectListing.isTruncated()) {
        ObjectListing emptyListing = new ObjectListing();
        emptyListing.setBucketName(objectListing.getBucketName());
        emptyListing.setDelimiter(objectListing.getDelimiter());
        emptyListing.setMarker(objectListing.getNextMarker());
        emptyListing.setMaxKeys(objectListing.getMaxKeys());
        emptyListing.setPrefix(objectListing.getPrefix());
        emptyListing.setTruncated(false);

        observable.onNext(objectListing);
        observable.onCompleted();
    }

    listObjects(new ListObjectsRequest(
            objectListing.getBucketName(),
            objectListing.getPrefix(),
            objectListing.getNextMarker(),
            objectListing.getDelimiter(),
            objectListing.getMaxKeys()), observable);
}
 
开发者ID:codewise,项目名称:RxS3,代码行数:22,代码来源:AsyncS3Client.java


注:本文中的com.amazonaws.services.s3.model.ObjectListing.setPrefix方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。