Solved the problem.
Printable View
Solved the problem.
Do you have some code we could look at? It's difficult to diagnose the problem without it.
I don't understand your problem,but let's assume that we have those streams:
in:the input stream from server
out: the output stream to server
outfile: the output stream to file.
I suppose that you have already created them.
now let's download that file:
Code Java:int i;//number of received bytes byte []data=new byte[100];//byte array to hold data //now: while((i=in.read(data))!=-1){ outfile.write(data,0,i); outfile.flush(); } in.close(); outfile.close(); out.close();
the line :
outfile.write(data,0,i); means : only write the bytes that I have just read and not more(those bytes are from 0 to i).
I hope this may help you.
Solved the problem.
Solved the problem.