Class DownloadManager

java.lang.Object
  extended by DownloadManager

public class DownloadManager
extends java.lang.Object

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.

See Also:
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

records

private Record[] records
A set of data records which represent information about language sound files. This may be only a subset of those contained in the DataFile


goodDownloads

private SoundDownload[] goodDownloads
represents those downloads which were successful


badDownloads

private SoundDownload[] badDownloads
represents those downloads which were not successful


freshDownloads

private SoundDownload[] freshDownloads
This set contains those SoundDownloads which have been downloaded since another class has called the getFreshDownloads method


hasFreshDownloads

private boolean hasFreshDownloads
This flag gets set when a new language sound file is successfully downloaded

Constructor Detail

DownloadManager

public DownloadManager(Record[] dataRecords)

DownloadManager

public DownloadManager()
Method Detail

hasFreshDownloads

public boolean hasFreshDownloads()
allows another class to know if this class has download new sound files and if it is worth calling the getFreshDownloads method


getFreshDownloads

public SoundDownload[] getFreshDownloads()
Returns a set of SoundDownload objects which can be used by the sound playing loop.


startDownloading

public void startDownloading()
Starts the process of downloading sound files from the internet. This should work as a background process so that the user does not have to wait for all the sound files to download before he or she starts to listen to them. This method is one of the main reasons I had for writing this program in java; namely that I wanted a threaded process so as to improve the users experience. The


print

public java.lang.String print()

printStatistics

public java.lang.String printStatistics()
allows the display of information about all the attempts to download resources from the internet.


main

public static void main(java.lang.String[] args)
                 throws java.lang.Exception
Throws:
java.lang.Exception


Hosted by www.Geocities.ws

1