net.sourceforge.atunes.kernel.modules.playlist
Class PlayListIO

java.lang.Object
  extended by net.sourceforge.atunes.kernel.modules.playlist.PlayListIO

public class PlayListIO
extends java.lang.Object

The Class PlayListIO.


Field Summary
static java.lang.String M3U_FILE_EXTENSION
          The Constant M3U_FILE_EXTENSION.
 
Constructor Summary
PlayListIO()
           
 
Method Summary
static java.util.List<AudioObject> getAudioObjectsFromFileNamesList(java.util.List<java.lang.String> fileNames)
          Returns a list of files contained in a list of file names.
static java.util.List<AudioObject> getFilesFromList(java.io.File file)
          Returns a list of files contained in a play list file.
static java.lang.Runnable getLoadPlayListProcess(java.util.List<java.lang.String> files)
          Runnable object used to load play list from a list of file names.
static javax.swing.filechooser.FileFilter getPlaylistFileFilter()
          FileFilter to be used when loading and saving a play list file.
static boolean isValidPlayList(java.lang.String playListFile)
          Checks if is valid play list.
static java.util.List<java.lang.String> read(java.io.File file)
          This function reads the filenames from the playlist file (m3u).
static boolean write(PlayList playlist, java.io.File file)
          Writes a play list to a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

M3U_FILE_EXTENSION

public static final java.lang.String M3U_FILE_EXTENSION
The Constant M3U_FILE_EXTENSION.

See Also:
Constant Field Values
Constructor Detail

PlayListIO

public PlayListIO()
Method Detail

getAudioObjectsFromFileNamesList

public static java.util.List<AudioObject> getAudioObjectsFromFileNamesList(java.util.List<java.lang.String> fileNames)
Returns a list of files contained in a list of file names.

Parameters:
fileNames - the file names
Returns:
the audio objects from file names list

getFilesFromList

public static java.util.List<AudioObject> getFilesFromList(java.io.File file)
Returns a list of files contained in a play list file.

Parameters:
file - the file
Returns:
the files from list

getLoadPlayListProcess

public static java.lang.Runnable getLoadPlayListProcess(java.util.List<java.lang.String> files)
Runnable object used to load play list from a list of file names.

Parameters:
files - the files
Returns:
the load play list process

getPlaylistFileFilter

public static final javax.swing.filechooser.FileFilter getPlaylistFileFilter()
FileFilter to be used when loading and saving a play list file.

Returns:
the playlist file filter

isValidPlayList

public static boolean isValidPlayList(java.lang.String playListFile)
Checks if is valid play list.

Parameters:
playListFile - the play list file
Returns:
true, if is valid play list

read

public static java.util.List<java.lang.String> read(java.io.File file)
This function reads the filenames from the playlist file (m3u). It will return all filenames with absolute path. For this playlists with relative pathname must be detected and the path must be added. Current problem of this implementation is clearly the charset used. Java reads/writes in the charset used by the OS! But for many *nixes this is UTF8, while Windows will use CP1252 or similar. So, as long as we have the same charset encoding or do not use any special character playlists will work (absolute filenames with a pathname incompatible with the current OS are not allowed), but as soon as we have say french accents in the filename a playlist created under an application using CP1252 will not import correctly on a UTF8 system (better: the files with accents in their filename will not). Only playlist with local files have been tested! Returns a list of file names contained in a play list file

Parameters:
file - The playlist file
Returns:
Returns an List of files of the playlist as String.

write

public static boolean write(PlayList playlist,
                            java.io.File file)
Writes a play list to a file.

Parameters:
playlist - the playlist
file - the file
Returns:
true, if write


Copyright © 2006-2008 The aTunes Team. All Rights Reserved.