How to know when there is network blip at the time of download using ReadableByteChannel and FileOutputStream?
<p>I would like to download a file of size 50MB using the below code and it works fine. But it was stopped when there is a network blip.</p>

<p>How to know when there is problem at the time of download</p>

<pre><code> URL finalURL = new URL(downloadURL);
 ReadableByteChannel rbc = Channels.newChannel(finalURL.openStream());
 FileOutputStream fos = new FileOutputStream(localPath);
 fos.getChannel().transferFrom(rbc, 0, 1 &lt;&lt; 24);
</code></pre>

<p>Thanks in advance.</p>
