Lizzy v1.1.1

christophedelory.playlist
Class SpecificPlaylistFactory

java.lang.Object
  extended by christophedelory.playlist.SpecificPlaylistFactory

public final class SpecificPlaylistFactory
extends Object

The playlist factory.

Version:
$Revision: 92 $
Author:
Christophe Delory

Method Summary
 SpecificPlaylistProvider findProviderByExtension(String filename)
          Searches for a provider handling the specific playlist files with the given extension string.
 SpecificPlaylistProvider findProviderById(String id)
          Searches for a provider handling the type of specific playlists identified by the given string.
static SpecificPlaylistFactory getInstance()
          Returns the unique class instance.
 List<SpecificPlaylistProvider> getProviders()
          Lists all currently installed playlist providers.
 SpecificPlaylist readFrom(File file)
          Reads a playlist from the specified file instance.
 SpecificPlaylist readFrom(URL url)
          Reads a playlist from the specified URL.
 void reloadProviders()
          Refreshes the list of playlist providers managed by this factory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static SpecificPlaylistFactory getInstance()
Returns the unique class instance.

Returns:
an instance of this class. Shall not be null.

reloadProviders

public void reloadProviders()
Refreshes the list of playlist providers managed by this factory. If new providers are added after the instantiation of this factory, you will need to call this method manually.


readFrom

public SpecificPlaylist readFrom(URL url)
                          throws IOException
Reads a playlist from the specified URL.

Parameters:
url - an URL to playlist contents. Shall not be null.
Returns:
a new playlist instance, or null if the format has been recognized, but the playlist is malformed.
Throws:
NullPointerException - if url is null.
IOException - if an I/O exception occurs.
See Also:
SpecificPlaylistProvider.readFrom(java.io.InputStream, java.lang.String, org.apache.commons.logging.Log), readFrom(File)

readFrom

public SpecificPlaylist readFrom(File file)
                          throws IOException
Reads a playlist from the specified file instance.

Parameters:
file - an file representing playlist contents. Shall not be null.
Returns:
a new playlist instance, or null if the format has been recognized, but the playlist is malformed.
Throws:
NullPointerException - if file is null.
SecurityException - if a required system property value cannot be accessed.
IOException - if an I/O exception occurs.
See Also:
readFrom(URL)

findProviderById

public SpecificPlaylistProvider findProviderById(String id)
Searches for a provider handling the type of specific playlists identified by the given string.

Parameters:
id - the unique string identifying a type of specific playlists. Not case sensitive. Shall not be null.
Returns:
a provider, or null if none was found.
Throws:
NullPointerException - if id is null.
See Also:
findProviderByExtension(java.lang.String)

findProviderByExtension

public SpecificPlaylistProvider findProviderByExtension(String filename)
Searches for a provider handling the specific playlist files with the given extension string.

Parameters:
filename - a playlist file name, or a simple extension string (with the leading '.' character, if appropriate). Not case sensitive. Shall not be null.
Returns:
a provider, or null if none was found.
Throws:
NullPointerException - if filename is null.
See Also:
findProviderById(java.lang.String)

getProviders

public List<SpecificPlaylistProvider> getProviders()
Lists all currently installed playlist providers.

Returns:
a list of specific playlist providers. May be empty but not null.
Since:
0.2.0
See Also:
findProviderByExtension(java.lang.String), findProviderById(java.lang.String)

© 2008-2009 Christophe Delory

Copyright © 2008-2009 Christophe Delory. All Rights Reserved.