Here you can find the source of download(String url, String destPath)
public static void download(String url, String destPath) throws IOException
//package com.java2s; //License from project: Open Source License import java.io.*; import java.net.URL; import java.nio.file.Files; public class Main { private static final int BUFFER = 2048; public static void download(String url, String destPath) throws IOException { InputStream downloadIn = new BufferedInputStream(new URL(url).openStream(), BUFFER); File destFile = new File(destPath); com.google.common.io.Files.createParentDirs(destFile); Files.copy(downloadIn, destFile.toPath()); }/*from www. j a v a 2 s.c o m*/ }