Hi, jules
How are you?
I meet an issue when download files through GET method.
The file size is 589322(Bytes), however, I can download only 567680(Bytes).
After that, there still 21642 Bytes.
I debugged it , and when it downloads 567680(Bytes), the inputStream. isExhausted() is true.
I use juce_1.46 and url class for this .
I tied many times, inputStream.isExhausted() becomes true earlier than it should be.
If you can show the same problem in 1.50 I’ll take a look, but obviously can’t spend time looking into things that were probably fixed many months ago.
Hi, jules
Thanks for reply.
I just tried 1_50, and it has the same issue as 1_46.
I am not sure if it is my fault or bug in juce.
I paste some my code here:
while (!input->isExhausted()){
pStream->writeFromInputStream(*input, 240000);
}
I also checked the difference between juce_46 and juce_50.
The major change for the classes used here is this function.
juce_readFromInternetFile , which is in
class WebInputStream : public InputStream
int read (void* dest, int bytes)
{
if (finished || isError())
{
return 0;
}
else
{
const int bytesRead = juce_readFromInternetFile (handle, dest, bytes);
position += bytesRead;
in juce_50 and juce_46, the implementing of juce_readFromInternetFile() changed a lot. I also see the fileOutputStream change between these two version, and they are almost the same.
another change is in side juce_URL.cpp. But I do not think it is some to do with this issue.
Any ideas?
Is this the appropriate approach to read from a URL? Feels like there should be a shortcut. For example, isn’t the input stream being buffered somewhere?
Silly question, but I presume you’re actually flushing and deleting your output file stream after you’ve finished the copy? Otherwise, you could obviously leave the end of the file not written to disk…