|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.univocity.api.statistics.DataTransferListener<UrlReaderProvider,File,DownloadStatistics>
com.univocity.api.statistics.DownloadListener
public abstract class DownloadListener
A listener of active downloads from remote locations into local files. Updates on the progress of each individual
download are sent to the user on the dataDownloaded(DownloadStatistics, boolean) method.
By default, updates to an individual download are sent every 250 ms, and immediately in case the download
completes or is aborted.
DataTransferListener,
DownloadStatistics,
DataTransferStatistics| Constructor Summary | |
|---|---|
DownloadListener()
Creates a default download list that invokes the dataDownloaded(DownloadStatistics, boolean) method after
at least 250ms have elapsed since the last call has been made for the same download process. |
|
DownloadListener(long notificationInterval)
Creates download list that invokes the dataDownloaded(DownloadStatistics, boolean) method after
a given interval has elapsed since the last call has been made for the same download process. |
|
| Method Summary | |
|---|---|
protected abstract void |
dataDownloaded(DownloadStatistics status,
boolean lastNotification)
Notifies of an update on the status of a download process. |
protected DownloadStatistics |
newDataTransfer(UrlReaderProvider source,
long totalSize,
File target)
Creates a a new DataTransfer |
void |
setUnit(String unitDescription,
long unitDivisor)
Defines a description of the unit of data being transferred and updates the unit divisor to amounts will be returned taking into account the division of the totals by the given divisor. |
| Methods inherited from class com.univocity.api.statistics.DataTransferListener |
|---|
aborted, completed, getActiveTransfers, isAborted, isRunning, isStarted, iterator, size, started, transferred |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DownloadListener()
dataDownloaded(DownloadStatistics, boolean) method after
at least 250ms have elapsed since the last call has been made for the same download process.
public DownloadListener(long notificationInterval)
dataDownloaded(DownloadStatistics, boolean) method after
a given interval has elapsed since the last call has been made for the same download process.
notificationInterval - how often, in milliseconds, the dataDownloaded(DownloadStatistics, boolean)
should be invoked for each individual download process in this list| Method Detail |
|---|
protected final DownloadStatistics newDataTransfer(UrlReaderProvider source,
long totalSize,
File target)
DataTransferListenerDataTransfer
newDataTransfer in class DataTransferListener<UrlReaderProvider,File,DownloadStatistics>source - where the data will be transferred fromtotalSize - the total size of the data to be transferredtarget - the target where the data will be transferred to
DataTransfer that will transfer data of size totalSize
from source to target
protected abstract void dataDownloaded(DownloadStatistics status,
boolean lastNotification)
status - an object with statistics and information about the download and its progresslastNotification - a flag indicating whether this notification is the last one (i.e. the download
completed or was aborted due to an error)
public void setUnit(String unitDescription,
long unitDivisor)
unitDivisor = 1024) or megabytes (unitDivisor = 1024*1024) for example.
unitDescription - the description of what unit of data is being transferredunitDivisor - the divisor to be applied over the totals accumulated by this class, so that the units
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||