helliker.id3
Class Playlist

java.lang.Object
  |
  +--java.util.AbstractCollection
        |
        +--java.util.AbstractList
              |
              +--java.util.AbstractSequentialList
                    |
                    +--java.util.LinkedList
                          |
                          +--helliker.id3.Playlist
All Implemented Interfaces:
java.lang.Cloneable, java.util.Collection, java.util.List, java.io.Serializable

public class Playlist
extends java.util.LinkedList

See Also:
Serialized Form

Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
Playlist()
           
 
Method Summary
 void loadFromDirectory(java.io.File dir, boolean recurse)
          Reads in mp3s from a directory and adds them to the this playlist.
 void loadFromFile(java.io.File m3uFile)
          Reads from an existing winamp playlist and reads in the files contained in that playlist.
 java.lang.String toString()
          Return a string representation of this object.
 void writeToFile(java.io.File dest)
          Creates a winamp styled playlist from the MP3Files contained in this playlist.
 
Methods inherited from class java.util.LinkedList
add, add, addAll, addAll, addFirst, addLast, clear, clone, contains, get, getFirst, getLast, indexOf, lastIndexOf, listIterator, remove, remove, removeFirst, removeLast, set, size, toArray, toArray
 
Methods inherited from class java.util.AbstractSequentialList
iterator
 
Methods inherited from class java.util.AbstractList
equals, hashCode, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, isEmpty, iterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

Playlist

public Playlist()
Method Detail

loadFromDirectory

public void loadFromDirectory(java.io.File dir,
                              boolean recurse)
                       throws java.io.IOException
Reads in mp3s from a directory and adds them to the this playlist. The recurse parameter should be set if you wish to grab mp3s from directories as well.
Parameters:
dir - the directory to look for mp3s in
recurse - whether or not to recurse subdirectories
Throws:
java.io.IOException - if the file specified is not a directory

loadFromFile

public void loadFromFile(java.io.File m3uFile)
                  throws PlaylistException,
                         java.io.FileNotFoundException,
                         java.io.IOException
Reads from an existing winamp playlist and reads in the files contained in that playlist.
Parameters:
m3uFile - the playlist file
Throws:
PlaylistException - if the file is corrupt
java.io.FileNotFoundException - if an error occurs
java.io.IOException - if an error occurs

writeToFile

public void writeToFile(java.io.File dest)
                 throws java.io.IOException
Creates a winamp styled playlist from the MP3Files contained in this playlist. If the destination is a directory, then the file will be created in that directory with the same name as the directory with a ".m3u" extension added. If the destination is a file then the playlist will be saved to that file.
Parameters:
dest - where to save the playlist
Throws:
java.io.IOException - if an error occurs

toString

public java.lang.String toString()
Return a string representation of this object. Actually returns the the text as it would be written to a playlist file.
Overrides:
toString in class java.util.AbstractCollection
Returns:
a string representation of this object