javazoom.jl.player
Class AudioDeviceFactory

java.lang.Object
  extended by javazoom.jl.player.AudioDeviceFactory
Direct Known Subclasses:
FactoryRegistry, JavaSoundAudioDeviceFactory

public abstract class AudioDeviceFactory
extends java.lang.Object

An AudioDeviceFactory class is responsible for creating a specific AudioDevice implementation. A factory implementation can be as simple or complex as desired and may support just one implementation or may return several implementations depending upon the execution environment.

When implementing a factory that provides an AudioDevice that uses class that may not be present, the factory should dynamically link to any specific implementation classes required to instantiate or test the audio implementation. This is so that the application as a whole can run without these classes being present. The audio device implementation, however, will usually statically link to the classes required. (See the JavaSound deivce and factory for an example of this.)

Since:
0.0.8
See Also:
FactoryRegistry

Constructor Summary
AudioDeviceFactory()
           
 
Method Summary
abstract  AudioDevice createAudioDevice()
          Creates a new AudioDevice.
protected  AudioDevice instantiate(java.lang.ClassLoader loader, java.lang.String name)
          Creates an instance of an AudioDevice implementation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioDeviceFactory

public AudioDeviceFactory()
Method Detail

createAudioDevice

public abstract AudioDevice createAudioDevice()
                                       throws JavaLayerException
Creates a new AudioDevice.

Returns:
a new instance of a specific class of AudioDevice.
Throws:
JavaLayerException - if an instance of AudioDevice could not be created.

instantiate

protected AudioDevice instantiate(java.lang.ClassLoader loader,
                                  java.lang.String name)
                           throws java.lang.ClassNotFoundException,
                                  java.lang.IllegalAccessException,
                                  java.lang.InstantiationException
Creates an instance of an AudioDevice implementation.

Parameters:
loader - The ClassLoader to use to load the named class, or null to use the system class loader.
name - The name of the class to load.
Returns:
A newly-created instance of the audio device class.
Throws:
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException


JavaZOOM 1999-2008