Java Utililty Methods URL Copy

List of utility methods to do URL Copy

Description

The list of methods to do URL Copy are organized into topic(s).

Method

voidcopyURLToFile(final URL source, final File destination)
copy URL To File
if (destination.getParentFile() != null && !destination.getParentFile().exists()) {
    destination.getParentFile().mkdirs();
if (destination.exists() && !destination.canWrite()) {
    throw new IllegalArgumentException("Unable to open file " + destination + " for writing.");
InputStream in = new BufferedInputStream(source.openStream());
copy(in, destination);
...
voidcopyURLToFile(URL source, File destination)
Copies bytes from the URL source to a file destination.
InputStream input = source.openStream();
try {
    FileOutputStream output = openOutputStream(destination);
    try {
        copy(input, output);
    } finally {
        closeQuietly(output);
} finally {
    closeQuietly(input);