Guest User

Untitled

a guest
Mar 4th, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. public class Download {
  2.  
  3. /**
  4. *
  5. * @param fileUrl an absolute url the downloading file
  6. * @throws IOException
  7. */
  8. public static void downloadFile(String fileUrl)
  9. throws IOException, InterruptedException {
  10. String links[] = new String[3];
  11. links[0] = "https://www.sitebuilderreport.com/assets/facebook-stock-up-08c6c9a855df26a3b13a34ac62bb75cc.jpg";
  12. links[1] = "https://www.bigstockphoto.com/images/homepage/2016_bigstock_picks.jpg";
  13. links[2] = "https://www.bigstockphoto.com/images/homepage/2016_bigstock_video.jpg";
  14.  
  15. // ExecutorService pool = Executors.newFixedThreadPool(links.length);
  16. // for (String link : links) {
  17. // String fileName = link.substring(link.lastIndexOf("/")+1);
  18. // pool.submit(new ThreadDownload(link));
  19. //// new Thread(new ThreadDownload(link), fileName).start();
  20. // }
  21. // pool.shutdown();
  22. // pool.awaitTermination(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment