本文整理汇总了Java中com.amazonaws.services.kinesis.model.ListStreamsResult.isHasMoreStreams方法的典型用法代码示例。如果您正苦于以下问题:Java ListStreamsResult.isHasMoreStreams方法的具体用法?Java ListStreamsResult.isHasMoreStreams怎么用?Java ListStreamsResult.isHasMoreStreams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.amazonaws.services.kinesis.model.ListStreamsResult
的用法示例。
在下文中一共展示了ListStreamsResult.isHasMoreStreams方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: listAllStreams
import com.amazonaws.services.kinesis.model.ListStreamsResult; //导入方法依赖的package包/类
/**
* Gets a list of all Amazon Kinesis streams
*
* @param kinesisClient
* The {@link AmazonKinesisClient} with Amazon Kinesis read privileges
* @return list of Amazon Kinesis streams
*/
public static List<String> listAllStreams(AmazonKinesisClient kinesisClient) {
ListStreamsRequest listStreamsRequest = new ListStreamsRequest();
listStreamsRequest.setLimit(10);
ListStreamsResult listStreamsResult = kinesisClient.listStreams(listStreamsRequest);
List<String> streamNames = listStreamsResult.getStreamNames();
while (listStreamsResult.isHasMoreStreams()) {
if (streamNames.size() > 0) {
listStreamsRequest.setExclusiveStartStreamName(streamNames.get(streamNames.size() - 1));
}
listStreamsResult = kinesisClient.listStreams(listStreamsRequest);
streamNames.addAll(listStreamsResult.getStreamNames());
}
return streamNames;
}
示例2: listStreams
import com.amazonaws.services.kinesis.model.ListStreamsResult; //导入方法依赖的package包/类
@Override
public Set<String> listStreams() {
AmazonKinesis amazonKinesis = KinesisClient.create(properties);
ListStreamsResult listStreamsResult = amazonKinesis.listStreams();
List<String> streamNames = listStreamsResult.getStreamNames();
Set<String> streamNamesCollection = new HashSet(streamNames);
while (listStreamsResult.isHasMoreStreams() && !streamNames.isEmpty()) {
listStreamsResult = amazonKinesis.listStreams(streamNames.get(streamNames.size() - 1));
streamNames = listStreamsResult.getStreamNames();
streamNamesCollection.addAll(streamNames);
}
return streamNamesCollection;
}