public interface DownloadItem
DownloadListener
to receive download update events for this particular download item.
Modifier and Type | Method and Description |
---|---|
void |
addDownloadListener(DownloadListener listener)
Adds the specified download listener to receive download update events from this download instance.
添加指定的下载侦听器,以接收来自此下载实例的下载更新事件。 |
void |
cancel()
Cancels this download.
取消此下载。 |
Browser |
getBrowser()
Returns the browser instance that initiated this download or
返回启动此下载的浏览器实例;如果已经处置此实例,则返回null。 null if this instance is already disposed.
|
long |
getCurrentSpeed()
Returns simple speed estimate in bytes/s.
返回以字节/秒为单位的简单速度估算值。 |
java.io.File |
getDestinationFile()
Returns destination file that indicates where the file will be downloaded.
返回指示文件将下载到的目标文件。 |
java.util.List<DownloadListener> |
getDownloadListeners()
Returns a list of all the download listeners registered on this download item.
返回在此下载项目上注册的所有下载侦听器的列表。 |
int |
getID()
Returns unique identifier of this download.
返回此下载的唯一标识符。 |
java.lang.String |
getMimeType()
Returns the MIME type of this download.
返回此下载的MIME类型。 |
int |
getPercentComplete()
Returns rough percent complete.
返回大致的完成百分比。 |
long |
getReceivedBytes()
Returns the number or received (downloaded) bytes.
返回数字或接收(下载)的字节数。 |
long |
getTotalBytes()
Returns the total size of a file in bytes.
返回文件的总大小(以字节为单位)。 |
java.lang.String |
getURL()
Returns URL of this download.
返回此下载的URL。 |
boolean |
isCanceled()
Indicates whether this download is canceled.
指示此下载是否被取消。 |
boolean |
isCompleted()
Indicates whether this download is completed.
指示此下载是否完成。 |
boolean |
isPaused()
Indicates whether this download is paused.
指示此下载是否暂停。 |
void |
pause()
Pauses this download.
暂停此下载。 |
void |
removeDownloadListener(DownloadListener listener)
Removes the specified download update listener so that it no longer receives download update events from this download instance.
删除指定的下载更新侦听器,以使其不再从该下载实例接收下载更新事件。 |
void |
resume()
Resumes this download.
恢复此下载。 |
void |
setDestinationFile(java.io.File destinationFile)
Modifies the destination file.
修改目标文件。 |
void addDownloadListener(DownloadListener listener)
listener
is
null
, no exception is thrown and no action is performed.
listener
- the download update listener.
-下载更新监听器。
void removeDownloadListener(DownloadListener listener)
listener
- the download update listener.
-下载更新监听器。
java.util.List<DownloadListener> getDownloadListeners()
DownloadListener
s or an empty list if no download listeners are currently registered.
此项的所有内容;如果当前未注册任何下载侦听器,则为空列表。
java.lang.String getURL()
Browser getBrowser()
null
if this instance is already disposed.
null
if this instance is already disposed.
启动此下载的浏览器实例,或者已经处置此实例。
boolean isPaused()
DownloadListener.onDownloadUpdated(com.teamdev.jxbrowser.chromium.events.DownloadEvent)
event to find out whether download is paused or not.
TRUE
when this download is paused.
暂停下载时。
boolean isCanceled()
DownloadListener.onDownloadUpdated(com.teamdev.jxbrowser.chromium.events.DownloadEvent)
event to find out whether download is canceled or not.
TRUE
when this download is canceled.
取消此下载时。
boolean isCompleted()
DownloadListener.onDownloadUpdated(com.teamdev.jxbrowser.chromium.events.DownloadEvent)
event to find out whether download is completed or not. When download is canceled this method also returns
true
. Use
isCanceled()
method to find out whether download is canceled or not.
TRUE
when this download is completed or canceled.
此下载完成或取消时。
java.lang.String getMimeType()
int getID()
long getCurrentSpeed()
int getPercentComplete()
long getTotalBytes()
long getReceivedBytes()
java.io.File getDestinationFile()
void setDestinationFile(java.io.File destinationFile)
DownloadHandler.allowDownload(DownloadItem)
method.
destinationFile
- new destination file.
-新的目标文件。
java.lang.IllegalArgumentException
- when
destinationFile
is
null
.
void pause()
void resume()
void cancel()