How to treat URL as a local file
Hi,
I am working on an existing piece of code. The whole code has been designed in such a way that all the methods take file as the argument. for example getMiMeType(File F) ........However, now my function is to add streaming capabilities so that lets say i can run the file http://www.xyz.com/ix.mpg and use the existing methods instead of writing new ones, how can i do that. Help Appreciated.
[410 byte] By [
muneeba] at [2007-11-26 12:51:16]

# 1
To a certain extent it might depend on how the File is being used.
But other than that you just create a class that derives from File and which implements the methods that the library uses (or all of them if possible and needed.) The functionality of that class would be to use your alternative location.
# 2
Fair enough, these are basically media files that will be read and then played. At the moment the application is stand alone so all the functions take arguments as files. Now however, if I want to add a file which is on lets say at some webserver, then i have got the problem. Because i cant find a way to treat the URL as a local file. However, the idea of extending the java.io.FIle is good but still too long.