Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Download {
- /**
- *
- * @param fileUrl an absolute url the downloading file
- * @throws IOException
- */
- public static void downloadFile(String fileUrl)
- throws IOException, InterruptedException {
- String links[] = new String[3];
- links[0] = "https://www.sitebuilderreport.com/assets/facebook-stock-up-08c6c9a855df26a3b13a34ac62bb75cc.jpg";
- links[1] = "https://www.bigstockphoto.com/images/homepage/2016_bigstock_picks.jpg";
- links[2] = "https://www.bigstockphoto.com/images/homepage/2016_bigstock_video.jpg";
- // ExecutorService pool = Executors.newFixedThreadPool(links.length);
- // for (String link : links) {
- // String fileName = link.substring(link.lastIndexOf("/")+1);
- // pool.submit(new ThreadDownload(link));
- //// new Thread(new ThreadDownload(link), fileName).start();
- // }
- // pool.shutdown();
- // pool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
- }
Advertisement
Add Comment
Please, Sign In to add comment