use of com.qcloud.cos.model.ObjectListing in project cos-java-sdk-v5 by tencentyun.
the class ListObjectTest method ListObjectStartWithNoMaxKey.
@Test
public void ListObjectStartWithNoMaxKey() {
if (!judgeUserInfoValid()) {
return;
}
ListObjectsRequest listObjectsRequest = new ListObjectsRequest().withBucketName(bucket).withDelimiter("/");
ObjectListing objectListing = cosclient.listObjects(listObjectsRequest);
assertEquals(1L, objectListing.getCommonPrefixes().size());
assertEquals(0L, objectListing.getObjectSummaries().size());
}
use of com.qcloud.cos.model.ObjectListing in project alluxio by Alluxio.
the class COSUnderFileSystem method getObjectListingChunk.
@Override
protected ObjectListingChunk getObjectListingChunk(String key, boolean recursive) throws IOException {
String delimiter = recursive ? "" : PATH_SEPARATOR;
key = PathUtils.normalizePath(key, PATH_SEPARATOR);
// In case key is root (empty string) do not normalize prefix
key = key.equals(PATH_SEPARATOR) ? "" : key;
ListObjectsRequest request = new ListObjectsRequest();
request.setBucketName(mBucketNameInternal);
request.setPrefix(key);
request.setMaxKeys(getListingChunkLength(mUfsConf));
request.setDelimiter(delimiter);
ObjectListing result = getObjectListingChunk(request);
if (result != null) {
return new COSObjectListingChunk(request, result);
}
return null;
}
Aggregations