Interface WebExtension.Download.Info
- Enclosing class:
WebExtension.Download
public static interface WebExtension.Download.Info
Interface for communicating the state of downloads to Web Extensions. See also WebExtensions/API/downloads/DownloadItem
-
Method Summary
Modifier and TypeMethodDescriptiondefault longReturns a number representing the number of bytes received so far from the host during the download.default booleanReturns a boolean indicating whether a currently-interrupted (e.g. paused) download can be resumed from the point where it was interrupted.default LongendTime()Returns a number representing the time when this download ended.default Integererror()Returns one of Interrupt Reason constants denoting the error reason.default LongReturns the estimated number of milliseconds between the UNIX epoch and when this download is estimated to be completed.default booleanReturns a boolean indicating whether a downloaded file still exists.default Stringfilename()Returns the filename.default longfileSize()Returns the total number of bytes in the whole file, after decompression.default Stringmime()Returns the downloaded file's MIME type.default booleanpaused()Returns a boolean indicating whether the download is paused i.e. if the download has stopped reading data from the host but has kept the connection open.default Stringreferrer()Returns a string representing the downloaded file's referrer.default longReturns the number of milliseconds between the UNIX epoch and when this download began.default intstate()Returns a new state; one of the state constants to indicate whether the download is in progress, interrupted or complete.default longReturns the total number of bytes in the file being downloaded.
-
Method Details
-
bytesReceived
@UiThread default long bytesReceived()Returns a number representing the number of bytes received so far from the host during the download. This does not take file compression into consideration.- Returns:
- a number representing the number of bytes received so far from the host during the download
-
canResume
@UiThread default boolean canResume()Returns a boolean indicating whether a currently-interrupted (e.g. paused) download can be resumed from the point where it was interrupted.- Returns:
- a boolean indicating whether a currently-interrupted (e.g. paused) download can be resumed from the point where it was interrupted
-
endTime
Returns a number representing the time when this download ended. This is null if the download has not yet finished.- Returns:
- a number representing the time when this download ended
-
error
Returns one of Interrupt Reason constants denoting the error reason.- Returns:
- one of Interrupt Reason constants denoting the error reason
-
estimatedEndTime
Returns the estimated number of milliseconds between the UNIX epoch and when this download is estimated to be completed. This is null if it is not known.- Returns:
- the estimated number of milliseconds between the UNIX epoch and when this download is estimated to be completed
-
fileExists
@UiThread default boolean fileExists()Returns a boolean indicating whether a downloaded file still exists.- Returns:
- a boolean indicating whether a downloaded file still exists
-
filename
-
fileSize
@UiThread default long fileSize()Returns the total number of bytes in the whole file, after decompression. A value of -1 means that the total file size is unknown.- Returns:
- the total number of bytes in the whole file, after decompression
-
mime
Returns the downloaded file's MIME type.- Returns:
- the downloaded file's MIME type
-
paused
@UiThread default boolean paused()Returns a boolean indicating whether the download is paused i.e. if the download has stopped reading data from the host but has kept the connection open.- Returns:
- a boolean indicating whether the download is paused i.e. if the download has stopped reading data from the host but has kept the connection open
-
referrer
Returns a string representing the downloaded file's referrer.- Returns:
- a string representing the downloaded file's referrer
-
startTime
@UiThread default long startTime()Returns the number of milliseconds between the UNIX epoch and when this download began.- Returns:
- the number of milliseconds between the UNIX epoch and when this download began
-
state
@UiThread default int state()Returns a new state; one of the state constants to indicate whether the download is in progress, interrupted or complete.- Returns:
- a new state; one of the state constants to indicate whether the download is in progress, interrupted or complete
-
totalBytes
@UiThread default long totalBytes()Returns the total number of bytes in the file being downloaded. This does not take file compression into consideration. A value of -1 here means that the total number of bytes is unknown.- Returns:
- the total number of bytes in the file being downloaded
-