0
我使用Java客户端库通过分页接收带有分页的Google文档信息。 我的代码:如何使用分页检索Google文档?
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);
}
我得到两个entries.But如果我改变
query.setStartIndex(1);
到
query.setStartIndex(3);
我得到相同的两个条目。
你能发布整个代码片段吗? –
我更新了我的问题。 – Hleb