Stefan Bodewig wrote, On 04/04/2003 17.21:
On Fri, 04 Apr 2003, Nicola Ken Barozzi <[EMAIL PROTECTED]> wrote:
What I mean is not to change the passing of a File object. I mean that we can *wrap* an URL in a File. So we pass a File, and use an URL, getting a Virtual File System.
How so - put the URI into the name and abuse File as a String? I'd really like to understand that.
We are talking about java.io.File here 8-)
Sure. Look at the JDK 1.4 version, it has this constructor:
public File(URI uri)
Why? Because a URI can be navigated, and it's possible to make a File from a URI.
We could do:
org.apache.tools.vfs.File extends java.io.File
and make
public File(String URI)
that also can accept a URI to create itself.
Look at all the methods of java.io.File: if I gave you just an url in the constructor, you could write almost, if not all, those methods.
So, if we make the method in the utils return a File that is in reality a org.apache.tools.vfs.File but still used as a File, we could make all tasks that use a file be able to accept an url.
url string -> in utils it's made into a org.apache.tools.vfs.File -> it's given as a java.io.File -> it's used as a java.io.File, but the methods inside use the "VFS"
Am I really missing the obvious? Could as well be.
-- Nicola Ken Barozzi [EMAIL PROTECTED] - verba volant, scripta manent - (discussions get forgotten, just code remains) ---------------------------------------------------------------------