wxURL GetInputStream deprecated? Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Trikko
Experienced Solver
Experienced Solver
Posts: 94
Joined: Tue Oct 18, 2005 8:28 pm
Location: Venice, IT
Contact:

wxURL GetInputStream deprecated?

Post by Trikko » Fri Jun 16, 2006 12:04 am

I see on documentation that wxURL GetInputStream is deprecated. They say to use wxFileSystem. I've tried to use it but it works in a different way.

It seems that when i use GetInputStream with wxURL and read some bytes from there it download data on the fly.

It seems that wxFileSystem blocks thread until *ALL* file is downloaded then they return a cached stream. So it's not the same. With the first method i can't avoid long freeze of thread and i can report progress to user...

phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Post by phlox81 » Fri Jun 16, 2006 10:04 am

Take a look at wxDownloadFile

Trikko
Experienced Solver
Experienced Solver
Posts: 94
Joined: Tue Oct 18, 2005 8:28 pm
Location: Venice, IT
Contact:

Post by Trikko » Fri Jun 16, 2006 10:17 am

phlox81 wrote:Take a look at wxDownloadFile
Thanks but it's not a problem for me. I just want to point out that on wx documentation they say: "Use wxFileSystem GetStream instead of wxURL->GetInputStream()". So it seems they works in the same way. But i don't think is exactly. And wxURL->GetInputStream() is deprecated, so you should not use it...

Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post by Cursor » Tue Jun 20, 2006 8:13 am

On this subject, in the wxInternetFSHandler code, after the wxURL::GetInputStream() invocation, wx creates a temp file where the net file is downloaded and a wxTemporaryFileInputStream is created to return the stream.

Why use a such system and why do not return the wxURL's InputStream directly ?
What is little and green, witch go up and down ??
Yoda playing with the force.

User avatar
Ryan Norton
Moderator
Moderator
Posts: 1319
Joined: Mon Aug 30, 2004 6:01 pm

Post by Ryan Norton » Tue Jun 20, 2006 6:12 pm

Cursor wrote:On this subject, in the wxInternetFSHandler code, after the wxURL::GetInputStream() invocation, wx creates a temp file where the net file is downloaded and a wxTemporaryFileInputStream is created to return the stream.

Why use a such system and why do not return the wxURL's InputStream directly ?
My (uninformed) guess is for seeking within the file...

Anyway, I'm the one who marked it as depreciated a loong time ago. I think at the time there was a desire for everyone to use wxFileSystem instead, although I don't remember clearly at the moment.

GetInputStream though has recieved so many bugfixes and doesn't suffer from being linked out like the http filesystem handler that I'd almost reccomend it over the alternatives for new apps. However, you might want to get the protocol of the wxURL and set the timeout of the wxHTTP object to something more reasonable.

So, at any rate it probably shouldn't be marked depreciated anymore (apologies to those confused).
[Mostly retired moderator, still check in to clean up some stuff]

Cursor
Earned some good credits
Earned some good credits
Posts: 120
Joined: Sun Aug 29, 2004 3:09 pm
Location: Grenoble, France
Contact:

Post by Cursor » Wed Jun 21, 2006 7:56 am

Ryan Norton wrote:My (uninformed) guess is for seeking within the file...
Thanks Ryan.
What is little and green, witch go up and down ??
Yoda playing with the force.

Post Reply