Java URL Download nio download(String url, String destPath)

Here you can find the source of download(String url, String destPath)

Description

download

License

Open Source License

Declaration

public static void download(String url, String destPath) throws IOException 

Method Source Code


//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*/
}

Related

  1. canDownload(String filePath)
  2. download(File dist, URL src)
  3. download(String from, String to)
  4. download(String link, File destFile)
  5. download(String url, File output)
  6. download(String url, String inputFile, String outputPath, String outputFile)
  7. download(URI source, File target)
  8. download(URL link, File outputFile)
  9. download(URL url, File out)