使用 Apache Httpclient 时,有没有办法获取下载状态?
无论如何,要让他下载状态,比如它已经完成了多少?
Anyway to get he downloading status like how much it has finished?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
无论如何,要让他下载状态,比如它已经完成了多少?
Anyway to get he downloading status like how much it has finished?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
这取决于™:服务器可以(或不)在发送内容之前发送 Content-Length 标头。在这种情况下,是的,这是可能的:获取标头值,然后获取响应输出流并按固定大小的块从中读取,并在每次迭代时更新状态。
如果标题不存在,则不,您不知道要阅读的其余内容。
It depends™: the server can (or not) send a Content-Length header before it sends the content itseft. In this case, yes, it's possible: get the header value, then get the response output steam and read from it by chunks of fixed size, and update the status at each iteration.
If the header is not present, no, you have no clue about the remaining content to read.