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


Java Page.iterateAll方法代码示例

本文整理汇总了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();
}
 
开发者ID:GoogleCloudPlatform,项目名称:getting-started-java,代码行数:24,代码来源:UserJourneyTestIT.java

示例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();
}
 
开发者ID:GoogleCloudPlatform,项目名称:getting-started-java,代码行数:26,代码来源:UserJourneyTestIT.java

示例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]
}
 
开发者ID:GoogleCloudPlatform,项目名称:java-docs-samples,代码行数:26,代码来源:ListLogs.java

示例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();
}
 
开发者ID:spotify,项目名称:flo,代码行数:14,代码来源:GcsTasks.java


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