我尝试了Google云端硬盘的某些功能,但无法从云端硬盘下载文件。我是否缺少一些功能来创建文件?无法使用Java API从Google云端硬盘下载文件
private static InputStream downloadFile(Drive authKey, File file) {
if (file.getDownloadUrl() != null && file.getDownloadUrl().length() > 0) {
try {
HttpResponse resp
= authKey.getRequestFactory().buildGetRequest(new GenericUrl(
file.getDownloadUrl())).execute();
//System.out.println("File Successfully Downloaded");
return resp.getContent();
} catch (IOException e) {
// An error occurred.
e.printStackTrace();
//System.out.println("Failed to Download File");
return null;
}
} else {
return null;
}
}
当我运行的功能,它成功地建立。但我没有看到任何东西,例如下载的文件等。
你有什么错误吗?你想下载什么样的文件? – Gerardo
你正在处理什么系统? (我可以帮助Android) – seanpj
@Gerardo没有任何错误。 我试图下载“.part1”文件,我以前分裂.. – septo13