santosh batta wrote:Hi Rob,
When I change the condition to >=0 or != -1 , the performance still got worse. Previously it was taking 2 min. to download 9MB file & now its taking 5 min.
Most likely it was taking 2 min. to download
part of a 9MB file, until read() returned 0. Even if you got the whole file
that time, the code is wrong and isn't guaranteed to work.
If performance is a problem, you might try wrapping your InputStream in a BufferedInputStream, if you're not already doing so.