本文整理汇总了Java中com.google.api.gax.paging.Page.iterateAll方法的典型用法代码示例。如果您正苦于以下问题:Java Page.iterateAll方法的具体用法?Java Page.iterateAll怎么用?Java Page.iterateAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.api.gax.paging.Page
的用法示例。
在下文中一共展示了Page.iterateAll方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tearDownClass
import com.google.api.gax.paging.Page; //导入方法依赖的package包/类
@AfterClass
public static void tearDownClass() {
// Clear the datastore
Datastore datastore = DatastoreOptions.getDefaultInstance().getService();
Batch batch = datastore.newBatch();
StructuredQuery<Key> query = Query.newKeyQueryBuilder()
.setKind("Book3").build();
for (QueryResults<Key> keys = datastore.run(query); keys.hasNext(); ) {
batch.delete(keys.next());
}
batch.submit();
// Delete any objects in the bucket
Storage storage = StorageOptions.getDefaultInstance().getService();
Page<Blob> blobs = storage.list(System.getProperty("bookshelf.bucket"));
List<BlobId> blobIds = new ArrayList<BlobId>();
for (Blob b : blobs.iterateAll()) {
blobIds.add(b.getBlobId());
}
storage.delete(blobIds);
service.stop();
}
示例2: tearDownClass
import com.google.api.gax.paging.Page; //导入方法依赖的package包/类
@AfterClass
public static void tearDownClass() {
// Delete any objects in the bucket
Storage storage = StorageOptions.getDefaultInstance().getService();
Page<Blob> blobs = storage.list(System.getProperty("bookshelf.bucket"));
List<BlobId> blobIds = new ArrayList<BlobId>();
for (Blob b : blobs.iterateAll()) {
blobIds.add(b.getBlobId());
}
storage.delete(blobIds);
// Clear the datastore if we're not using the local emulator
if (!LOCAL_TEST) {
Datastore datastore = DatastoreOptions.getDefaultInstance().getService();
Batch batch = datastore.newBatch();
StructuredQuery<Key> query = Query.newKeyQueryBuilder()
.setKind("Book3").build();
for (QueryResults<Key> keys = datastore.run(query); keys.hasNext(); ) {
batch.delete(keys.next());
}
batch.submit();
}
service.stop();
}
示例3: main
import com.google.api.gax.paging.Page; //导入方法依赖的package包/类
/** Expects an existing Stackdriver log name as an argument. */
public static void main(String... args) throws Exception {
// [START listlogs]
// Instantiates a client
LoggingOptions options = LoggingOptions.getDefaultInstance();
String logName = args[0];
try (Logging logging = options.getService()) {
String logFilter = "logName=projects/" + options.getProjectId() + "/logs/" + logName;
// List all log entries
Page<LogEntry> entries = logging.listLogEntries(
EntryListOption.filter(logFilter));
do {
for (LogEntry logEntry : entries.iterateAll()) {
System.out.println(logEntry);
}
entries = entries.getNextPage();
} while (entries != null);
}
// [END listlogs]
}
示例4: blobExistsInner
import com.google.api.gax.paging.Page; //导入方法依赖的package包/类
private static Blob blobExistsInner(URI uri) {
final String bucketName = uri.getAuthority();
final String prefix = uri.getPath().startsWith("/") ? uri.getPath().substring(1) : uri.getPath();
final Page<Blob> list = STORAGE.list(bucketName, prefix(prefix));
for (final Blob blob : list.iterateAll()) {
if (blob.getName().equals(prefix)) {
return blob;
}
}
throw new NotReady();
}