Java URL Download downloadFile(URL fileUrl, File out)

Here you can find the source of downloadFile(URL fileUrl, File out)

Description

download File

License

Open Source License

Declaration

public static final void downloadFile(URL fileUrl, File out) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

import java.net.URL;

import java.util.Scanner;

public class Main {
    public static final void downloadFile(URL fileUrl, File out) {
        try {/*from  www .j  a v  a  2  s .  c  o m*/
            PrintStream outStream = new PrintStream(out);
            Scanner connectionScanner = new Scanner(fileUrl.openStream());

            while (connectionScanner.hasNextByte()) {
                outStream.println(connectionScanner.nextByte());
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. downloadFile(String url, String path)
  2. downloadFile(String urlPath, File file)
  3. downloadFile(String urlString)
  4. downloadFile(String urlString, String filename)
  5. downloadFile(String urlToDownload, File locationToStore)
  6. downloadFile(URL theURL, String filePath)
  7. downloadFile(URL url, File toFile)
  8. downloadFile(URL url, String name)
  9. downloadFile(URL url, String path, String fileName)