Package com.avsystem.anjay
Class AnjayDownload
- java.lang.Object
-
- com.avsystem.anjay.AnjayDownload
-
public final class AnjayDownload extends java.lang.ObjectManages downloads started by user.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnjayDownload.ConfigurationConfiguration forAnjayDownload.static classAnjayDownload.ResultResult of the download process.static classAnjayDownload.ResultDetailsDetails about error occured during download.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabort()Abort the ongoing download.static AnjayDownloadstartDownload(Anjay anjay, AnjayDownload.Configuration config, AnjayDownloadHandlers handlers)Requests asynchronous download of an external resource.
-
-
-
Method Detail
-
startDownload
public static AnjayDownload startDownload(Anjay anjay, AnjayDownload.Configuration config, AnjayDownloadHandlers handlers) throws java.lang.Exception, java.util.ConcurrentModificationException
Requests asynchronous download of an external resource.Download will create a new socket that will be later included in the list returned by
Anjay.getSockets(). Callingserveon such socket may cause callingonNextBlockif received packet is the next expected chunk of downloaded data andonDownloadFinishedif the transfer completes or fails. Request packet retransmissions are managed by Anjay scheduler, and sent byserve.- Parameters:
anjay- Anjay instance to be used for performing download.config- Download configuration.handlers- Implementation of handlers to be called by downloader.- Returns:
AnjayDownloadobject which may be used to abort the download process.- Throws:
java.lang.Exception- If config is invalid or download can't be started.java.util.ConcurrentModificationException- if the security configuration usedAnjaySecurityConfigFromDmand the configuration expired due toAnjay.serve(java.nio.channels.SelectableChannel)orAnjay.schedRun()calls happening in between.
-
abort
public void abort()
Abort the ongoing download. Does nothing if the download is already finished.
-
-