How to partially download google drive files?

扶醉桌前 提交于 2019-12-25 08:47:25

问题


I am trying to download specific bytes of a file from google drive. When I set bytes=0-1000, it works fine. When I am specifying a particular range of bytes (as shown below), the size of the video getting downloaded is correct but, I couldn't play the video.

HttpRequest httpRequestGet = drive.getRequestFactory().buildGetRequest(new GenericUrl(url.toString()));
httpRequestGet.getHeaders().setRange("bytes=" + 10000 + "-" + 200000);

Am I missing something? Thanks in advance.


回答1:


It could be probably because by specifying a byte range further down in the file you are skipping the entire header of the file, which results in just a garbled block of data.



来源:https://stackoverflow.com/questions/45801256/how-to-partially-download-google-drive-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!