Mp3dings 
20100427

net.sourceforge.mp3dings.export
Class WinampXMLPlaylistExporter

java.lang.Object
  extended by net.sourceforge.mp3dings.export.AbstractExporter
      extended by net.sourceforge.mp3dings.export.WinampXMLPlaylistExporter
All Implemented Interfaces:
Serializable, Exporter

public class WinampXMLPlaylistExporter
extends AbstractExporter
implements Serializable

Exports data as a WinampXML playlist (.b4s).

Version:
$Revision: 115 $ ($Date: 2007-11-06 00:46:25 +0100 (Di, 06 Nov 2007) $)
Author:
Moritz Ringler
See Also:
Serialized Form

Constructor Summary
WinampXMLPlaylistExporter()
          Creates a new WinampXMLPlaylistExporter.
 
Method Summary
static String escape(String s)
          Escapes XML special characters and non-ascii characters in the specified string.
 String getBlock(int fileIndex, Map blockdata)
          Returns a single <entry> tag.
 String getExtension()
          Returns the file extension for this exporter's target file type.
 String getFooter(int numEntries)
          Returns the closing <WinampXML> doctag and the closing <playlist> tag.
 String getHeader()
          Returns the xml declaration, the opening <WinampXML> doctag and the opening <playlist> tag.
 String getName()
          Returns a string description of this exporter's target file type.
 
Methods inherited from class net.sourceforge.mp3dings.export.AbstractExporter
export, export, getBlockKeys, getFileFallback, getFileFilter, getFooterData, getFooterKeys, getHeaderData, getHeaderKeys, getImplementations, getKeys, getNumberOfEntries, setEncoding, setFileFallback, setFooterData, setHeaderData, setKeys
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WinampXMLPlaylistExporter

public WinampXMLPlaylistExporter()
Creates a new WinampXMLPlaylistExporter.

Method Detail

getBlock

public String getBlock(int fileIndex,
                       Map blockdata)
Returns a single <entry> tag. The output looks as follows:
  <entry Playstring="[filepath]">
      <Name>[artist] - [title]</Name>
      <Length>[length in ms]</Length>
  </entry>
 

Specified by:
getBlock in class AbstractExporter
Parameters:
fileIndex - ignored
blockdata - a map containing the record data
See Also:
AbstractExporter.export(Object[] keys, Object[][] data)

getHeader

public String getHeader()
Returns the xml declaration, the opening <WinampXML> doctag and the opening <playlist> tag. The output looks as follows:
  <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  <WinampXML>
          <playlist
              num_entries="[number of datasets]"
              label="Mp3dings Playlist">
 

Specified by:
getHeader in class AbstractExporter

getFooter

public String getFooter(int numEntries)
Returns the closing <WinampXML> doctag and the closing <playlist> tag. The output looks as follows:
      </playlist>
  </WinampXML>
 

Specified by:
getFooter in class AbstractExporter
Parameters:
numEntries - ignored

getName

public String getName()
Returns a string description of this exporter's target file type.

Specified by:
getName in interface Exporter
Specified by:
getName in class AbstractExporter
Returns:
the name of the target file type. Currently this is "Winamp XML Playlist (*.b4s)", but this may change in future versions.

getExtension

public String getExtension()
Returns the file extension for this exporter's target file type.

Overrides:
getExtension in class AbstractExporter
Returns:
a file extension including the leading dot. Currently this is ".b4s", but this may change in future versions.

escape

public static String escape(String s)
Escapes XML special characters and non-ascii characters in the specified string.


Mp3dings 
20100427