How to create file object from URL object (image) [duplicate]

Use Apache Common IO’s FileUtils:

import org.apache.commons.io.FileUtils

FileUtils.copyURLToFile(url, f);

The method downloads the content of url and saves it to f.

Leave a Comment