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.

jschella at 2007-7-7 16:38:36 > top of Java-index,Core,Core APIs...
# 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.

muneeba at 2007-7-7 16:38:36 > top of Java-index,Core,Core APIs...
# 3
> However, the idea of> extending the java.io.FIle is good but still too long.You have exactly three choices- Extend File- Modify the API- Don't support this feature.
jschella at 2007-7-7 16:38:36 > top of Java-index,Core,Core APIs...
# 4
Does api published as interface or class? In former case, you can you java dynamic proxy to deal in this kind of situations.In latter case - it would be good idea to publish a new API with new features (will let the users use the old API)
AjaySingh516a at 2007-7-7 16:38:36 > top of Java-index,Core,Core APIs...