java.lang.ObjectDownloadManager
public class DownloadManager
This class manages the process of downloading a set of sound resources from the internet. The class makes the SoundDownloads available to other classes incrementally as they become available. This allows an application to start using the sound files which are available without waiting for the whole download process to complete.
DataFile, SoundDownload, Record etc| Field Summary | |
|---|---|
private SoundDownload[] |
badDownloads
represents those downloads which were not successful |
private SoundDownload[] |
freshDownloads
This set contains those SoundDownloads which have been downloaded since another class has called the getFreshDownloads method |
private SoundDownload[] |
goodDownloads
represents those downloads which were successful |
private boolean |
hasFreshDownloads
This flag gets set when a new language sound file is successfully downloaded |
private Record[] |
records
A set of data records which represent information about language sound files. |
| Constructor Summary | |
|---|---|
DownloadManager()
|
|
DownloadManager(Record[] dataRecords)
|
|
| Method Summary | |
|---|---|
SoundDownload[] |
getFreshDownloads()
Returns a set of SoundDownload objects which can be used by the sound playing loop. |
boolean |
hasFreshDownloads()
allows another class to know if this class has download new sound files and if it is worth calling the getFreshDownloads method |
static void |
main(java.lang.String[] args)
|
java.lang.String |
print()
|
java.lang.String |
printStatistics()
allows the display of information about all the attempts to download resources from the internet. |
void |
startDownloading()
Starts the process of downloading sound files from the internet. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private Record[] records
private SoundDownload[] goodDownloads
private SoundDownload[] badDownloads
private SoundDownload[] freshDownloads
private boolean hasFreshDownloads
| Constructor Detail |
|---|
public DownloadManager(Record[] dataRecords)
public DownloadManager()
| Method Detail |
|---|
public boolean hasFreshDownloads()
public SoundDownload[] getFreshDownloads()
public void startDownloading()
public java.lang.String print()
public java.lang.String printStatistics()
public static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception