public class BasicCachingControl extends java.lang.Object implements CachingControl
AbstractController
LENGTH_UNKNOWN
Constructor and Description |
---|
BasicCachingControl(AbstractController c,
long length)
Constructs a BasicCachingControl for the given
AbstractController.
|
Modifier and Type | Method and Description |
---|---|
void |
addToProgress(long toAdd)
Adds an amount of bytes to the media already downloaded.
|
void |
blockWhilePaused()
Blocks the current thread until the download is not
paused.
|
long |
getContentLength()
Get the total number of bytes in the media being
downloaded.
|
long |
getContentProgress()
Get the total number of bytes of media data that have been
downloaded so far.
|
java.awt.Component |
getControlComponent()
Get a Component that provides additional download control.
|
java.awt.Component |
getProgressBarComponent()
Get a Component for displaying the download progress.
|
boolean |
isDownloading()
Check whether or not media is being downloaded.
|
boolean |
isPaused()
Tells whether the media download is paused or not.
|
void |
reset(long length)
Resets this BasicCachingControl.
|
void |
setContentLength(long length)
Set the length of the media without reinitializing the
progress bar.
|
void |
setContentProgress(long progress)
Set the current progress of the media download.
|
void |
setDone()
Indicates that the media is fully downloaded.
|
void |
setDownLoading(boolean isDownloading)
Sets whether the AbstractController is downloading or not.
|
protected void |
setPaused(boolean isPaused)
Sets whether the AbstractController is paused or not.
|
public BasicCachingControl(AbstractController c, long length)
c
- The AbstractController from which
CachingControlEvents are posted whenever the
status of this BasicCachingControl changes.length
- The length of the media to be downloaded.protected void setPaused(boolean isPaused)
isPaused
- boolean indicating whether the media is
paused.public boolean isPaused()
public void blockWhilePaused()
public void setDownLoading(boolean isDownloading)
isDownloading
- boolean indicating whether the media is
downloading.public void reset(long length)
length
- The length of the media.public void setContentLength(long length)
length
- The length of the media.public void setContentProgress(long progress)
progress
- Number of bytes that have been downloaded.public void addToProgress(long toAdd)
toAdd
- Number of bytes that have been downloaded
since the last time this method or
setContentProgress have been called.public void setDone()
public boolean isDownloading()
isDownloading
in interface CachingControl
public long getContentLength()
getContentLength
in interface CachingControl
public long getContentProgress()
getContentProgress
in interface CachingControl
public java.awt.Component getProgressBarComponent()
getProgressBarComponent
in interface CachingControl
public java.awt.Component getControlComponent()
getControlComponent
in interface CachingControl
getControlComponent
in interface Control