Here you can find the source of downloadBinary(URL BaseURL, String Name, File TargetDirectory)
public static void downloadBinary(URL BaseURL, String Name, File TargetDirectory) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.net.*; public class Main { public static void downloadBinary(URL BaseURL, String Name, File TargetDirectory) throws IOException { URL TheURL = new URL(BaseURL, Name); File TestFile = new File(TargetDirectory, Name); downloadBinary(TheURL, TestFile); }//from w ww .ja va 2 s . com public static void downloadBinary(URL TheURL, File TestFile) throws IOException { OutputStream outf = new FileOutputStream(TestFile); String test = TheURL.toString(); System.out.println(test); InputStream in = TheURL.openStream(); downloadBinary(in, outf); } public static void downloadBinary(InputStream ins, OutputStream outf) throws IOException { byte[] holder = new byte[4096]; InputStream in = new BufferedInputStream(ins); OutputStream out = new BufferedOutputStream(outf); int Nread = in.read(holder); int col = 0; while (Nread > -1) { out.write(holder, 0, Nread); Nread = in.read(holder); System.out.print("."); if (col++ > 60) { System.out.println(); col = 0; } } System.out.println(); in.close(); out.close(); } }