downloading to a file in Java - very slow
<p>Given the following example code:</p>

<pre><code>somefile = new URL("http://somefile.rar");
ReadableByteChannel rbc = Channels.newChannel(somefile.openStream());
FileOutputStream fos = new FileOutputStream("test");
long start = System.currentTimeMillis();
fos.getChannel().transferFrom(rbc, 0, 1 &lt;&lt; 24);
long end = System.currentTimeMillis();
System.out.println(end-start);
</code></pre>

<p>The file in question is 14MB.  When I download it using the code above, it takes 26-30 seconds every time. I noticed that, when downloading it from java, there are periods where no bytes are being transferred at all.  When I download the same file from, say, a browser, it downloads in 4 seconds or less.  Any idea what the problem is here?</p>
