All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class taxman.MediaLoader

java.lang.Object
   |
   +----taxman.MediaLoader

public class MediaLoader
extends Object
implements Runnable
This is the loader thread for the Media Loader Design Set. This design set allows a program to download media features as a separate thread while recieving updates on the progress periodically.


Constructor Index

 o MediaLoader()
This constructor is useful non-multithreading IMAGE loads from the local machine.
 o MediaLoader(Applet)
This constructor is useful non-multithreading loads.
 o MediaLoader(MediaRecord[], MediaObserver[])
This constructor is useful for multi-threading.
 o MediaLoader(MediaRecord[], MediaObserver[], Applet)
This constructor is useful for multi-threading.

Method Index

 o getMediaItem(MediaRecord)
Retrieves the media item given by the media record.
 o retrieveAudio(String)
Retrieves an audio clip from the current document base using the path and name given in Name.
 o retrieveAudio(String, Applet)
The static version of the non-static function of the same name.
 o retrieveImage(String)
Retrieves a single image given by the current document base and the path and file name in Name.
 o retrieveImage(String, Applet, Component)
The static version of the retrieve image, this method does the same thing as it's non-static counterpart but does not require an object instantiation to work.
 o run()
For multi-threaded apps, this method allow the load process to procede as a separate thread.

Constructors

 o MediaLoader
 public MediaLoader()
This constructor is useful non-multithreading IMAGE loads from the local machine. For added functionality, use other constructors.

 o MediaLoader
 public MediaLoader(Applet a)
This constructor is useful non-multithreading loads. It takes an applet which is used to help load audio files or files across a network.

Parameters:
a - The Applet to use for loading functionality and URL of the program
 o MediaLoader
 public MediaLoader(MediaRecord mr[],
                    MediaObserver mo[])
This constructor is useful for multi-threading. It takes a list of media items to load, a list of MediaObservers to be notified of loads. This version can load ONLY IMAGES. To load audio also use the constructor that takes an applet as thelast parameter, it will then be able to run and will update the user as to its progress through the observers.

Parameters:
mr - Array of media to load (can be length one,... though using the non-threaded version of getMediaItem would be more likely
mo - Array of media observers which would like to be notified of media load progress
 o MediaLoader
 public MediaLoader(MediaRecord mr[],
                    MediaObserver mo[],
                    Applet a)
This constructor is useful for multi-threading. It takes a list of media items to load, a list of MediaObservers to be notify of loads and an applet for loading. If created within a thread, it will then be able to run and will update the user as to its progress through the observers.

Parameters:
mr - Array of media to load (can be length one,... though using the non-threaded version of getMediaItem would be more likely
mo - Array of media observers which would like to be notified of media load progress
a - The applet that provides the loading functionality

Methods

 o getMediaItem
 public MediaRecord getMediaItem(MediaRecord mr) throws MalformedURLException
Retrieves the media item given by the media record. Supply the fileName and type of the media record and the method will return the completely filled record.

Parameters:
mr - The media record describing which media to get
Throws: MalformedURLException
thrown when the URL (filename) for the item is bad or wrong
 o retrieveImage
 public Image retrieveImage(String Name) throws MalformedURLException
Retrieves a single image given by the current document base and the path and file name in Name. The method waits for full image load before returning.

Parameters:
Name - path and file name of the image to load
Throws: MalformedURLException
thrown when the URL (filename) for the item is bad or wrong
 o retrieveImage
 public static Image retrieveImage(String Name,
                                   Applet app,
                                   Component cmp) throws MalformedURLException
The static version of the retrieve image, this method does the same thing as it's non-static counterpart but does not require an object instantiation to work.

Parameters:
Name - the path and file name for the image to load
app - The applet (could be null) that is connected with the image
cmp - A component (could also be the applet) that is interested in the image.
Throws: MalformedURLException
thrown when the URL (filename) for the item is bad or wrong
 o retrieveAudio
 public AudioClip retrieveAudio(String Name) throws MalformedURLException
Retrieves an audio clip from the current document base using the path and name given in Name. Note: this method will return an null handle if a constructor without an applet was used.

Parameters:
Name - path and file name for the AudioClip to load.
Throws: MalformedURLException
thrown when the URL (filename) for the item is bad or wrong
 o retrieveAudio
 public static AudioClip retrieveAudio(String Name,
                                       Applet app) throws MalformedURLException
The static version of the non-static function of the same name. This one does not require an object instantiation to work.

Parameters:
Name - path and file name for the AudioClip to load.
app - The name of the applet (required) that can load the audio clip
Throws: MalformedURLException
thrown when the URL (filename) for the item is bad or wrong
 o run
 public void run()
For multi-threaded apps, this method allow the load process to procede as a separate thread. Observers are notified as to the progress of the download from time to time.


All Packages  Class Hierarchy  This Package  Previous  Next  Index