Dear all,
I am trying to setup a code to download a file from the internet,
Currently, the code is very simple... Is just creating a bufferedInputStream and making a read within a loop.
But for unknown reason, at some point, the "in.read(data,0,1024);" get stucked forever...
I have no idea how to solve this,
I don't think it is related to a server side, since I can easilly download this file using other tools like wget (or somply my browser)
thanks in advance for your help,
Loicus
URL url = new URL("http://projects.hepforge.org/frog/Download/DemoFiles/V1_10/CMS/CMS.geom.gz"); InputStream in = new BufferedInputStream(url.openStream()); byte data[] = new byte[1024]; int count = 0; int Totalcount = 0; while(true){ System.out.printf("Read = %d --> %d\n",count, Totalcount); count = in.read(data,0,1024); if(count<0)break; Totalcount+=count; } System.out.printf("Download is done\n"); in.close();