Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/image-processing/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将file.getDownloadUrl()设置为null,即使我尝试将作用域设置为DriveScopes.DRIVE\u READONLY和DriveScopes.all()_Java_Image Processing_Google Drive Api - Fatal编程技术网

Java 将file.getDownloadUrl()设置为null,即使我尝试将作用域设置为DriveScopes.DRIVE\u READONLY和DriveScopes.all()

Java 将file.getDownloadUrl()设置为null,即使我尝试将作用域设置为DriveScopes.DRIVE\u READONLY和DriveScopes.all(),java,image-processing,google-drive-api,Java,Image Processing,Google Drive Api,我同时使用了DriveScopes.DRIVE\u READONLY和DriveScopes.all(),但我仍然得到 file.getDownloadUrl()为空 private final static Collection scopes=DriveScopes.all(); InputStream in=null; if(file.getDownloadUrl()!=null&&file.getDownloadUrl().length()>0){ HttpResponse resp=dr

我同时使用了DriveScopes.DRIVE\u READONLY和DriveScopes.all(),但我仍然得到 file.getDownloadUrl()为空

private final static Collection scopes=DriveScopes.all();
InputStream in=null;
if(file.getDownloadUrl()!=null&&file.getDownloadUrl().length()>0){
HttpResponse resp=drive.getRequestFactory().buildGetRequest(新
GenericUrl(file.getDownloadUrl()).execute();
inputStrem=resp.getContent();
}

您使用的API版本是v2还是v3?另外,它是什么类型的文件?我正在使用v2。甚至我也使用了v3。它是一个图像文件OutputStream out=new ByteArrayOutputStream();drive.files().export(file.getId(),“image/jpeg”).executemedia和downloadto(out);和drive.files().get(file.getId()).executeAndDownloadTo(out);它不起作用
downloadUrl
仅为非谷歌文档填充。你是用电脑拍到这张照片的吗?您是否已检查资源是否包含任何
exportLinks
?您使用的API版本是v2还是v3?另外,它是什么类型的文件?我正在使用v2。甚至我也使用了v3。它是一个图像文件OutputStream out=new ByteArrayOutputStream();drive.files().export(file.getId(),“image/jpeg”).executemedia和downloadto(out);和drive.files().get(file.getId()).executeAndDownloadTo(out);它不起作用
downloadUrl
仅为非谷歌文档填充。你是用电脑拍到这张照片的吗?您是否已检查资源是否包含任何
导出链接
private final static Collection<String> scopes=DriveScopes.all(); 

InputStream in=null;
if (file.getDownloadUrl() != null && file.getDownloadUrl().length() > 0) {
HttpResponse resp = drive.getRequestFactory().buildGetRequest(new 
GenericUrl(file.getDownloadUrl())).execute();
inputStrem = resp.getContent();
}