org.xith3d.loaders.sound
Class ExtensionSoundLoader

java.lang.Object
  extended by org.xith3d.loaders.sound.SoundLoader
      extended by org.xith3d.loaders.sound.ExtensionSoundLoader

public class ExtensionSoundLoader
extends SoundLoader

This SoundLoader utilizes the SoundLoader implementation, that is assotiated with the requested Sound resource's extension.


Constructor Summary
ExtensionSoundLoader()
           
ExtensionSoundLoader(java.util.Map<java.lang.String,SoundLoader> extensionMap)
           
 
Method Summary
 java.util.Map<java.lang.String,SoundLoader> getExtensionMap()
           
static ExtensionSoundLoader getInstance()
           
 SoundLoader getMappedSoundLoader(java.lang.String extension)
           
 SoundContainer loadSound(java.io.InputStream in)
          This method loads the Sound from an InputStream.
 SoundContainer loadSound(java.lang.String filename)
          This method loads the Scene from a file.
 SoundContainer loadSound(java.net.URL url)
          This method loads the Sound from a URL.
 void mapExtension(java.lang.String extension, SoundLoader loader)
          Maps the lowercase of the extension to the given SoundLoader.
 void setExtensionMap(java.util.Map<java.lang.String,SoundLoader> extensionMap)
          Sets the Map, that maps extensions to SoundLoaders.
 
Methods inherited from class org.xith3d.loaders.sound.SoundLoader
loadBackgroundSound, loadBackgroundSound, loadBackgroundSound, loadPointSound, loadPointSound, loadPointSound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExtensionSoundLoader

public ExtensionSoundLoader(java.util.Map<java.lang.String,SoundLoader> extensionMap)

ExtensionSoundLoader

public ExtensionSoundLoader()
Method Detail

getInstance

public static ExtensionSoundLoader getInstance()
Returns:
the ExtensionSoundLoader instance to use as singleton.

setExtensionMap

public void setExtensionMap(java.util.Map<java.lang.String,SoundLoader> extensionMap)
Sets the Map, that maps extensions to SoundLoaders.


getExtensionMap

public java.util.Map<java.lang.String,SoundLoader> getExtensionMap()
Returns:
the Map, that maps extensions to SoundLoaders.

mapExtension

public void mapExtension(java.lang.String extension,
                         SoundLoader loader)
Maps the lowercase of the extension to the given SoundLoader.

Parameters:
extension -
loader -

getMappedSoundLoader

public SoundLoader getMappedSoundLoader(java.lang.String extension)
Parameters:
extension -
Returns:
the SoundLoader mapped to the lowercase of the given extension.

loadSound

public SoundContainer loadSound(java.io.InputStream in)
                         throws java.io.IOException
This method loads the Sound from an InputStream.

Specified by:
loadSound in class SoundLoader
Parameters:
in - the InputStream to load the Sound from. It isn't necessary to explicitly pass an instance of BufferedInputStream, since it is created on demand.
Throws:
java.io.IOException

loadSound

public SoundContainer loadSound(java.net.URL url)
                         throws java.io.IOException
This method loads the Sound from a URL.

Specified by:
loadSound in class SoundLoader
Parameters:
url - the URL to load the Sound from.
Throws:
java.io.IOException

loadSound

public SoundContainer loadSound(java.lang.String filename)
                         throws java.io.IOException
This method loads the Scene from a file.

Specified by:
loadSound in class SoundLoader
Parameters:
filename - the file's name to load the Sound from.
Throws:
java.io.IOException