本文整理了Java中com.google.api.services.storage.model.Objects.getNextPageToken()
方法的一些代码示例,展示了Objects.getNextPageToken()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Objects.getNextPageToken()
方法的具体详情如下:
包路径:com.google.api.services.storage.model.Objects
类名称:Objects
方法名:getNextPageToken
暂无
代码示例来源:origin: Netflix/Priam
@Override
public boolean hasNext() {
if (this.iterator.hasNext()) {
return true;
}
while (this.objectsContainerHandle.getNextPageToken() != null && !iterator.hasNext())
try { // if here, you have iterated through all elements of the previous page, now, get
// the next page of results
this.listObjectsSrvcHandle.setPageToken(objectsContainerHandle.getNextPageToken());
this.iterator = createIterator();
} catch (Exception e) {
throw new RuntimeException(
"Exception encountered fetching elements, see previous messages for details.",
e);
}
return this.iterator.hasNext();
}
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public Collection<InetSocketAddress> getRegisteredAddresses() throws IgniteSpiException {
init();
Collection<InetSocketAddress> addrs = new ArrayList<>();
try {
Storage.Objects.List listObjects = storage.objects().list(bucketName);
com.google.api.services.storage.model.Objects objects;
do {
objects = listObjects.execute();
if (objects == null || objects.getItems() == null)
break;
for (StorageObject object : objects.getItems())
addrs.add(addrFromString(object.getName()));
listObjects.setPageToken(objects.getNextPageToken());
}
while (null != objects.getNextPageToken());
}
catch (Exception e) {
throw new IgniteSpiException("Failed to get content from the bucket: " + bucketName, e);
}
return addrs;
}
代码示例来源:origin: apache/incubator-druid
} while (objects.getNextPageToken() != null);
代码示例来源:origin: googleapis/google-cloud-java
? Lists.transform(objects.getPrefixes(), objectFromPrefix(bucket))
: ImmutableList.<StorageObject>of());
return Tuple.of(objects.getNextPageToken(), storageObjects);
} catch (IOException ex) {
span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage()));
代码示例来源:origin: google/google-api-java-client-samples
public static Iterable<StorageObject> list(Storage storage, String bucketName)
throws IOException {
List<List<StorageObject>> pagedList = Lists.newArrayList();
Storage.Objects.List listObjects = storage.objects().list(bucketName);
Objects objects;
do {
objects = listObjects.execute();
List<StorageObject> items = objects.getItems();
if (items != null) {
pagedList.add(objects.getItems());
}
listObjects.setPageToken(objects.getNextPageToken());
} while (objects.getNextPageToken() != null);
return Iterables.concat(pagedList);
}
代码示例来源:origin: GoogleCloudPlatform/java-docs-samples
/**
* Fetch a list of the objects within the given bucket.
*
* @param bucketName the name of the bucket to list.
* @return a list of the contents of the specified bucket.
*/
public static List<StorageObject> listBucket(String bucketName)
throws IOException, GeneralSecurityException {
Storage client = StorageFactory.getService();
Storage.Objects.List listRequest = client.objects().list(bucketName);
List<StorageObject> results = new ArrayList<StorageObject>();
Objects objects;
// Iterate through each page of results, and add them to our results list.
do {
objects = listRequest.execute();
// Add the items in this page of results to the list we'll return.
results.addAll(objects.getItems());
// Get the next page, in the next iteration of this loop.
listRequest.setPageToken(objects.getNextPageToken());
} while (null != objects.getNextPageToken());
return results;
}
// [END list_bucket]
代码示例来源:origin: spinnaker/kayenta
objectsList.setPageToken(objects.getNextPageToken());
} while (objects.getNextPageToken() != null);
} catch (IOException e) {
log.error("Could not fetch items from Google Cloud Storage: {}", e);
代码示例来源:origin: com.netflix.spinnaker.clouddriver/clouddriver-appengine
listMethod.setPageToken(objects.getNextPageToken());
} while (objects.getNextPageToken() != null);
executor.shutdown();
代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-google-cloud-platform-core
pageToken = objects.getNextPageToken();
} while (pageToken != null);
return MatchResult.create(Status.OK, results);
代码示例来源:origin: com.google.cloud.bigdataoss/gcsio
listedPrefixes.addAll(prefixes);
return items.getNextPageToken();
代码示例来源:origin: org.apache.beam/beam-sdks-java-extensions-google-cloud-platform-core
pageToken = objects.getNextPageToken();
} while (pageToken != null);
代码示例来源:origin: com.google.gcloud/gcloud-java-storage
@Override
public Tuple<String, Iterable<StorageObject>> list(final String bucket, Map<Option, ?> options) {
try {
Objects objects = storage.objects()
.list(bucket)
.setProjection(DEFAULT_PROJECTION)
.setVersions(VERSIONS.getBoolean(options))
.setDelimiter(DELIMITER.getString(options))
.setPrefix(PREFIX.getString(options))
.setMaxResults(MAX_RESULTS.getLong(options))
.setPageToken(PAGE_TOKEN.getString(options))
.setFields(FIELDS.getString(options))
.execute();
Iterable<StorageObject> storageObjects = Iterables.concat(
firstNonNull(objects.getItems(), ImmutableList.<StorageObject>of()),
objects.getPrefixes() != null
? Lists.transform(objects.getPrefixes(), objectFromPrefix(bucket))
: ImmutableList.<StorageObject>of());
return Tuple.of(objects.getNextPageToken(), storageObjects);
} catch (IOException ex) {
throw translate(ex);
}
}
代码示例来源:origin: com.google.cloud/google-cloud-storage
? Lists.transform(objects.getPrefixes(), objectFromPrefix(bucket))
: ImmutableList.<StorageObject>of());
return Tuple.of(objects.getNextPageToken(), storageObjects);
} catch (IOException ex) {
span.setStatus(Status.UNKNOWN.withDescription(ex.getMessage()));
内容来源于网络,如有侵权,请联系作者删除!