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


Java ListObjectsRequest.setDelimiter方法代码示例

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


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

示例1: listBucket

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
public List<String> listBucket(String bkt, String prefix, String delimiter) throws IOException {

        ListObjectsRequest listRequest = new ListObjectsRequest();
        listRequest.setBucketName(bkt);
        listRequest.setDelimiter(delimiter);
        listRequest.setPrefix(prefix);

        ObjectListing listing = s3.listObjects(listRequest);

        ArrayList<String> list = new ArrayList<String>();

        for (S3ObjectSummary summ : listing.getObjectSummaries()) {
            list.add(summ.getKey());
        }

        return list;
    }
 
开发者ID:modcs,项目名称:caboclo,代码行数:18,代码来源:AmazonClient.java

示例2: shouldListCommonPrefixes_ContainingFiles

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
@Test
public void shouldListCommonPrefixes_ContainingFiles() throws IOException {
    // Given
    ListObjectsRequest request = new ListObjectsRequest();
    request.setBucketName(bucketName);
    request.setPrefix("COUNTRY_BY_DATE/2014/05/");
    request.setDelimiter("/");

    // When
    Observable<ObjectListing> listing = client.listObjects(request);
    ObjectListing amazonListing = amazonS3Client.listObjects(request);

    // Then
    assertThat(listing)
            .ignoreFields(fieldsToIgnore)
            .isEqualTo(amazonListing)
            .isNotTruncated();
}
 
开发者ID:codewise,项目名称:RxS3,代码行数:19,代码来源:AsyncS3ClientTest.java

示例3: shouldListCommonPrefixes_ContainingDirectories

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
@Test
public void shouldListCommonPrefixes_ContainingDirectories() throws IOException {
    // Given
    ListObjectsRequest request = new ListObjectsRequest();
    request.setBucketName(bucketName);
    request.setPrefix("COUNTRY_BY_DATE/2014/");
    request.setDelimiter("/");

    // When
    Observable<ObjectListing> listing = client.listObjects(request);
    ObjectListing amazonListing = amazonS3Client.listObjects(request);

    // Then
    assertThat(listing)
            .ignoreFields(fieldsToIgnore)
            .isEqualTo(amazonListing)
            .isNotTruncated();
}
 
开发者ID:codewise,项目名称:RxS3,代码行数:19,代码来源:AsyncS3ClientTest.java

示例4: listFileData

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
@Override
public List<FileData> listFileData(String path) {
    List<FileData> ret = new ArrayList<FileData>();
    try {
        String prefix = extraPath + path;
        if (!prefix.endsWith("/")) {
            prefix = prefix + "/";
        }
        prefix = StringUtils.removeStart(prefix, "/");
        ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucketName).withPrefix(prefix);
        listObjectsRequest.setDelimiter("/");
        ObjectListing objectListing;
        do {
            objectListing = s3Client.listObjects(listObjectsRequest);
            for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
                String fileName = FilenameUtils.getName(FilenameUtils.normalize(objectSummary.getKey()));
                if (StringUtils.isNotBlank(fileName)) {
                    ret.add(new FileData(path, fileName));
                }
            }
            listObjectsRequest.setMarker(objectListing.getNextMarker());
        } while (objectListing.isTruncated());
    } catch (AmazonS3Exception e) {
        LOG.error("Error Listing Files: " + e, e);
        throw new RuntimeException(e);
    }
    return ret;
}
 
开发者ID:intuit,项目名称:Tank,代码行数:29,代码来源:S3FileStorage.java

示例5: getChildren

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
@Override
public List<RemoteFile> getChildren(String folderName) throws IOException {
    if (!folderName.endsWith("/")) {
        folderName = folderName + "/";
    }

    ListObjectsRequest listRequest = new ListObjectsRequest();
    listRequest.setBucketName(getBucketName());
    listRequest.setDelimiter("/");
    listRequest.setPrefix(folderName);

    ObjectListing listing = s3.listObjects(listRequest);

    ArrayList<RemoteFile> list = new ArrayList<>();

    for (S3ObjectSummary summ : listing.getObjectSummaries()) {
        String name = summ.getKey();
        long size = summ.getSize();

        boolean isDirectory = isFolder(name);

        RemoteFile file = new RemoteFile(name, isDirectory, size);
        list.add(file);
    }

    return list;
}
 
开发者ID:modcs,项目名称:caboclo,代码行数:28,代码来源:AmazonClient.java

示例6: s3ListObjects

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
private ObjectListing s3ListObjects(String pathPrefix, String delimiter) {

        ListObjectsRequest listObjectsRequest = new ListObjectsRequest();
        listObjectsRequest.setBucketName(currentAccount.getBucket());
        listObjectsRequest.setPrefix(pathPrefix);

        if (delimiter != null) {
            listObjectsRequest.setDelimiter(delimiter);
        }

        AmazonS3 s3Client = awsService.getS3Client(currentAccount);

        return s3Client.listObjects(listObjectsRequest);
    }
 
开发者ID:githublemming,项目名称:CloudTrailViewer,代码行数:15,代码来源:S3FileHandler.java

示例7: shouldListCommonPrefixesInBatches_ContainingFiles

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
@Test
public void shouldListCommonPrefixesInBatches_ContainingFiles() throws IOException {
    // Given
    ListObjectsRequest request = new ListObjectsRequest();
    request.setBucketName(bucketName);
    request.setPrefix("COUNTRY_BY_DATE/2014/05/");
    request.setMaxKeys(1);
    request.setDelimiter("/");

    // When
    ObjectListing amazonListing = amazonS3Client.listObjects(request);
    Observable<ObjectListing> listing = client.listObjects(request);

    // Then
    while (amazonListing.isTruncated()) {
        ObjectListing objectListing = listing.toBlocking().single();

        assertThat(objectListing)
                .ignoreFields(fieldsToIgnore)
                .isEqualTo(amazonListing)
                .isTruncated();

        amazonListing = amazonS3Client.listNextBatchOfObjects(amazonListing);
        listing = client.listNextBatchOfObjects(objectListing);
    }

    assertThat(listing)
            .ignoreFields(fieldsToIgnore)
            .isEqualTo(amazonListing)
            .isNotTruncated();
}
 
开发者ID:codewise,项目名称:RxS3,代码行数:32,代码来源:AsyncS3ClientTest.java

示例8: shouldListCommonPrefixesInBatches_ContainingDirectories

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
@Test
public void shouldListCommonPrefixesInBatches_ContainingDirectories() throws IOException {
    // Given
    ListObjectsRequest request = new ListObjectsRequest();
    request.setBucketName(bucketName);
    request.setPrefix("COUNTRY_BY_DATE/2014/");
    request.setMaxKeys(1);
    request.setDelimiter("/");

    // When
    Observable<ObjectListing> listing = client.listObjects(request);
    ObjectListing amazonListing = amazonS3Client.listObjects(request);

    // Then
    while (amazonListing.isTruncated()) {
        ObjectListing objectListing = listing.toBlocking().single();

        assertThat(objectListing)
                .ignoreFields(fieldsToIgnore)
                .isEqualTo(amazonListing)
                .isTruncated();

        amazonListing = amazonS3Client.listNextBatchOfObjects(amazonListing);
        listing = client.listNextBatchOfObjects(objectListing);
    }

    assertThat(listing)
            .ignoreFields(fieldsToIgnore)
            .isEqualTo(amazonListing)
            .isNotTruncated();
}
 
开发者ID:codewise,项目名称:RxS3,代码行数:32,代码来源:AsyncS3ClientTest.java

示例9: listChildren

import com.amazonaws.services.s3.model.ListObjectsRequest; //导入方法依赖的package包/类
@Override
public List<ObjectInfo> listChildren(String path, boolean recurse) throws IOException {
  log.debug("List children at {}/{}", bucket, path);

  ListObjectsRequest request = new ListObjectsRequest();
  request.setBucketName(this.bucket);
  request.setPrefix(path);
  if (!recurse) {
    request.setDelimiter("/");
    if (!path.endsWith("/")) {
      request.setPrefix(path + "/");
    }
  }

  List<ObjectInfo> children = Lists.newArrayList();

  ObjectListing objectListing = s3Client.listObjects(request);
  while (true) {

    for (String commonPrefix : objectListing.getCommonPrefixes()) {
      children.add(new S3DirInfo(commonPrefix));
    }

    for (S3ObjectSummary entry : objectListing.getObjectSummaries()) {
      children.add(new S3FileInfo(entry));
    }

    if (!objectListing.isTruncated()) {
      break;
    }

    objectListing = s3Client.listNextBatchOfObjects(objectListing);
  }

  return children;
}
 
开发者ID:justinsb,项目名称:cloudata,代码行数:37,代码来源:S3ObjectStore.java


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