如何使用分页检索Google文档? [英] How to use paging for retrieving Google docs?

查看:102
本文介绍了如何使用分页检索Google文档?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用Java客户端库通过分页接收Google文档信息. 我的代码:

I wand to receive google docs info with paging using Java Client Library. My code:

private static final String URL_STRING = "https://docs.google.com/feeds/default/private/full/";

public List<DocumentListEntry> getAllDocs() throws Exception {
    URL feedUri = new URL(URL_STRING);
    DocumentQuery query = new DocumentQuery(feedUri);
    query.setMaxResults(2);
    query.setStartIndex(1);
    DocumentListFeed feed = client.getFeed(query, DocumentListFeed.class);
    return feed.getEntries();
}

并处理条目:

List<DocumentListEntry> docList = gDocumentsRetriever.getAllDocs();
for (DocumentListEntry entry : docList) {
    processEntry(oAuthToken, gDocumentsRetriever, entry);
}

我得到两个条目.但是,如果我更改

I get two entries.But if I change

query.setStartIndex(1);

query.setStartIndex(3);

我得到两个相同的条目.

i get same two entries.

推荐答案

我发现了如何实现此问题的方法: http://code.google.com/apis/documents/docs /3.0/developers_guide_java.html#pagingThroughResults

I found how this issue can be realized: http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html#pagingThroughResults

对于其他服务,它以相同的方式实现.

For other services it realizes in the same way.

这篇关于如何使用分页检索Google文档?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆