i used your code but
java.lang.OutOfMemoryError: Java heap space
be shown,do you know how can i fixed this,
(i want to implement download service for client and the file mabe on server hard disk or database)

I am wondering if there is a speceal reason for using final Inputstream and OutputSream.
In my Application I seem to copy more then one Inputstream to one Outputstream one by one.
It would not be very appropriate, since I don’t know how many that will be in the first place.

HI. Is it just prefer File I/O? I used this method with inputStream come from internet and the outputstream is socket output. It works. However , I notice there is lots of CG in the log. comparing with tradition way(read inputstream into byte[] buffer and write byte[] to outputstream). Is it implying that it is more copy with the tradition way when it is not File I/O?.The code is running on Android device but I don’t it matter.