如何部分下载谷歌驱动器文件? [英] How to partially download google drive files?

查看:171
本文介绍了如何部分下载谷歌驱动器文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从谷歌驱动器下载文件的特定字节。当我设置字节= 0-1000时,它工作正常。当我指定特定范围的字节时(如下所示),下载的视频大小是正确的,但我无法播放视频。

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

我错过了什么吗?这可能是因为通过在文件的下方指定一个字节范围,您可以跳过整个头文件,导致只是一个乱码的数据块。


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.

解决方案

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.

这篇关于如何部分下载谷歌驱动器文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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