HttpURLConnection reading input streams fails
<p>I have a file of size 5MB &amp; want to download through a HttpURLConnection ( target is like "http://...../songs/Beatles_And I Love Her.mp3").</p>

<p>I'm trying to do it as follows</p>

<pre><code>URL url = new URL("http://........../songs/Beatles_And I Love Her.mp3");

URLConnection urlConnection = url.openConnection(); 
HttpURLConnection httpURLConnection = (HttpURLConnection)urlConnection;

httpURLConnection.getResponseCode(); 
InputStream stream = httpURLConnection.getInputStream();

byte buf[] = new byte[128]; 
do 
{ 
    int numread = stream.read(buf); 
    if (numread &lt;= 0)
    { 
        stream.close(); 
        break; 
    }
} while (true);
</code></pre>

<p>But the problem is that it only reads only 2KB to 3KB of data and after that it is returning -1 and exiting.</p>
