Title: RE: filenames versus URI's

I think you're missing something.  The following sequence:

File aFile = new File("C:\\My dog");
String s = (aFile.toURL()).toString();

results in a String s that looks like: "file:/C:/My dog".

That's not a valid URI. The space between "My" and "dog"
is not a valid character, and must be specified as %20.

I don't know of any standard Java methods that will
produce a valid URI for that filename.

-----Original Message-----
From: Alex Rosen [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 12:00 PM
To: [EMAIL PROTECTED]
Subject: RE: filenames versus URI's


It would be nice to provide a helpful error message if the invalid URI
string looks like a file, telling the user that filenames are not accepted
here, only URIs.

> A utility method that
> can convert filenames to URIs would be a nice addition, though.

Am I missing something? There's already a File.toURL() method.

Alex


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to