Downloading Zip files too slow
I have two concerns...
1. I want to keep track of all the bytes downloaded thus allowing user to stop and resume downloading of the files... my code below works fine.. but it is too slow.. as it is counting each byte.. is there an alternative to this ?
2. When i add BUFFEREDouputSTREAM to speed up the process... 1. i dont have to count bytes downloaded 2. Zip file downloaded is corrupt it has differnt size on server and onlocal drive.
I wiill highly appreciate help from anyone. Thanks.
[CODE]
URL url = new URL(s1);
java.io.InputStream inputstream = url.openStream();
DataInputStream datainputstream = new DataInputStream(inputstream);
FileOutputStream fileoutputstream = new FileOutputStream(dto, true);
//BufferedOutputStream bufferedOutputStream= new BufferedOutputStream(fileoutputstream);
PrintStream printstream = new PrintStream(fileoutputstream);
datainputstream.skipBytes(already);
int j;
do
{
l++;
j = datainputstream.read();
if(l > 6000)
{
l = 0;
Thread.yield();
}
String s = String.valueOf(j);
if(j != -1)
{
printstream.write(j);
i = i + 1;
k++;
}
already++;
} while(j != -1);
}
catch(Exception _ex) { _ex.printStackTrace(); }

