D
D
Denis2018-07-23 06:26:26
Android
Denis, 2018-07-23 06:26:26

How to use stream in retrofit 2 when downloading large amounts of data?

Good day!
I needed to receive large files from the server as a base64 string wrapped in a soap response from the server (yes, yes, the method is strange)
I tried using @Streaming for retrofit 2, based on the instructions from this site
https://futurestud.io/tutorials /retrofit-2-how-to-...
On a test file, via a direct link from Google Drive, the instruction works and a 400 MB file is downloaded fine using ((Response)response).body().byteStream(), and here when trying to do the same thing with "my" server, for some reason retrofit pumps out the entire file (all xml (soap)), and does not give control to byteStream, as a result of which the program crashes from lack of memory.
Please tell me what could be the reason for this behaviour.
PS Feel free to ask for additional information, I will provide everything, I just don’t know what might be needed now, but the whole essence of the code is shown in the instructions at the link above.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question