com.alee.utils.file
Interface FileDownloadListener

All Superinterfaces:
java.util.EventListener

public interface FileDownloadListener
extends java.util.EventListener

This listener interface provides all required methods to observe and manipulate the download process. Check out downloadFile methods from FileUtils to see how this listener can be used.

Author:
Mikle Garin

Method Summary
 void fileDownloaded(java.io.File file)
          Called when file download completed.
 void fileDownloadFailed(java.lang.Throwable e)
          Called when file download failed.
 void partDownloaded(int totalBytesDownloaded)
          Called when another file part have been downloaded.
 boolean shouldStopDownload()
          Returns whether download operation should stop or not.
 void sizeDetermined(int totalSize)
          Called when remote file size retrieved.
 

Method Detail

sizeDetermined

void sizeDetermined(int totalSize)
Called when remote file size retrieved.

Parameters:
totalSize - file size

partDownloaded

void partDownloaded(int totalBytesDownloaded)
Called when another file part have been downloaded.

Parameters:
totalBytesDownloaded - total bytes downloaded so far

fileDownloaded

void fileDownloaded(java.io.File file)
Called when file download completed.

Parameters:
file - downloaded local file

fileDownloadFailed

void fileDownloadFailed(java.lang.Throwable e)
Called when file download failed.

Parameters:
e - exception that caused download to fail

shouldStopDownload

boolean shouldStopDownload()
Returns whether download operation should stop or not. This method is getting called before and after each time-consuming opearation (for example file part download).

Returns:
true if you want to stop download, false otherwise