code: public static void copyURLToFile(final URL source, final File destination, final int connectionTimeout, final int readTimeout) throws UncheckedIOException {
          InputStream is = null;
          try {
              final URLConnection connection = source.openConnection();
              connection.setConnectTimeout(connectionTimeout);
              connection.setReadTimeout(readTimeout);
              is = connection.getInputStream();
  
              write(destination, is);
          } catch (IOException e) {
              throw new UncheckedIOException(e);
          } finally {
              close(is);
          }
      }
docs: Copies bytes from the URL <code>source</code> to a file
  <code>destination</code>. The directories up to <code>destination</code>
  will be created if they don't already exist. <code>destination</code>
  will be overwritten if it already exists.
  
  @param source  the <code>URL</code> to copy bytes from, must not be {@code null}
  @param destination  the non-directory <code>File</code> to write bytes to
  (possibly overwriting), must not be {@code null}
  @param connectionTimeout the number of milliseconds until this method
  will timeout if no connection could be established to the <code>source</code>
  @param readTimeout the number of milliseconds until this method will
  timeout if no data could be read from the <code>source</code>
  @throws UncheckedIOException if <code>source</code> URL cannot be opened
  @throws UncheckedIOException if <code>destination</code> is a directory
  @throws UncheckedIOException if <code>destination</code> cannot be written
  @throws UncheckedIOException if <code>destination</code> needs creating but can't be
  @throws UncheckedIOException if an IO error occurs during copying