jGuru
Register Email
This is not phishing, this is art!
Read more here what this is about.
    Password
This is not phishing, this is art!
Read more here what this is about.
Forgot your
password?
HOME FAQS FORUMS DOWNLOADS ARTICLES PEERSCOPE LEARN

  Search
This is not phishing, this is art!
Read more here what this is about.
  jGuru Search Help

Question Why did the toURL() method of File get deprecated in Java 6? Should I stop using it now.
Topics Java:API:IO:File System
Author John Zukowski PREMIUM
Created Jan 22, 2006


Answer
The toURL() method of File does not properly escape characters that aren't valid in a URL. You can write better code today without waiting for Java 6 by calling the toURL() method after calling toURI() on a File object:
    URL url1 = file.toURL();         // bad
    URL url2 = file.toURI().toURL(); //good


Is this item helpful?  yes  no     Previous votes   Yes: 2  No: 0



Comments and alternative answers

Comment on this FAQ entry

There are currently no comments

Ask A Question



 
Related Links

IO FAQ

IO Forum

I/O in Java 2 SDK

Java I/O package documentation

Lesson: Reading and Writing (Sun Tutorial)

jGuru Serialization FAQ

Wish List
Features
About jGuru
Contact Us

 


internet.commediabistro.comJusttechjobs.comGraphics.com

Search:
This is not phishing, this is art!
Read more here what this is about.

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers