Reputation: 229
I have problem with stream downloading. @streaming annotation not worked as expected. I receive responseBody only after finish downloading. So I can't download file with streaming, because file downloaded in memory and then a receive it and save to cache directory.
My retrofit api:
public interface DownloadingAmazonApi {
@GET
@Streaming
Observable<ResponseBody> downloadFile(@Url String url);
}
Usage:
downloadingAmazonApi.downloadFile(url)
.observeOn(Schedulers.io())
.map(body -> writeResponseBodyToDisk(body, type))
.map(localUrl -> ......))
...
Why @streaming not working? I tried to use different links (amazon and another hostings). I expect, that I will receive responseBody with stream immediately after start downloading and I will cache this stream into storage (without downloading into memory).
Upvotes: 0
Views: 550
Reputation: 229
I dont know what is it. I remove HttpLoggingInterseptor and stream worked as expected
Upvotes: 2