nidhin nidhin - 1 year ago 148
Java Question

How to create file object from URL object

I need to create a File object from URL object
My requirement is
I need to create a file object of a web image (say googles logo)

URL url = new URL("");
File f = create image from url object

Answer Source

Using FileUtils in Apache Common IO to simplify the problem:


FileUtils.copyURLToFile(url, f);

The method downloads the URL, url, and save to file f.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download