cz.vity.freerapid.plugins.webclient.interfaces
Interface HttpFileDownloadTask

All Known Implementing Classes:
DownloadNewPluginsTask, DownloadTask, RunCheckTask

public interface HttpFileDownloadTask

Interface that represents Task of downloading file - its downloading process.

Author:
Vity

Method Summary
 HttpDownloadClient getClient()
          Client associated with current file - its HTTP connections are used to grab a file
 HttpFile getDownloadFile()
          Returns file that is given to be downloaded
 boolean isTerminated()
          Checks whether current downloading process has been stopped
 void saveToFile(InputStream inputStream)
          Method that handles direct saving file onto physical disc.
 void sleep(int seconds)
          Sets file download state to WAITING.
 

Method Detail

getDownloadFile

HttpFile getDownloadFile()
Returns file that is given to be downloaded

Returns:
file for downloading

getClient

HttpDownloadClient getClient()
Client associated with current file - its HTTP connections are used to grab a file

Returns:
actual instance of HttpDownloadClient

saveToFile

void saveToFile(InputStream inputStream)
                throws Exception
Method that handles direct saving file onto physical disc. file download state is set to COMPLETED automatically

Parameters:
inputStream - - Http response stream, which contains data to be saved on the disk - should not be null
Throws:
Exception - Error during writing or if inputStream is null

sleep

void sleep(int seconds)
           throws InterruptedException
Sets file download state to WAITING. Stops download thread for given time.

Parameters:
seconds - time to sleep
Throws:
InterruptedException - if the thread was interrupted during sleeping

isTerminated

boolean isTerminated()
Checks whether current downloading process has been stopped

Returns:
true if downloading of the file was interrupted