org.qtunes.ff
Class TrackReader

java.lang.Object
  extended by org.qtunes.ff.TrackReader
All Implemented Interfaces:
Service
Direct Known Subclasses:
MP4Handler, TrackWriter

public abstract class TrackReader
extends java.lang.Object
implements Service

A TrackReader loads the tracks from disk


Field Summary
static java.lang.String[] MP3GENRES
           
 
Constructor Summary
TrackReader()
           
 
Method Summary
abstract  javax.sound.sampled.AudioInputStream getAudioInputStream(java.io.File file)
          Return the AudioInputStream for the specified File.
static TrackReader getTrackReader(java.io.File file)
          Return the appropriate TracKReader for the specified file - the list of readers is built in and no context is required
static TrackReader getTrackReader(ServiceContext context, java.io.File file)
          Return the appropriate TracKReader for the specified file
static TrackReader getTrackReader(ServiceContext context, java.lang.String type)
          Return the appropriate TracKReader for the specified type
static TrackReader getTrackReader(java.lang.String type)
           
abstract  java.lang.String getType()
          Get the type of track read by this reader, eg "mp3".
abstract  boolean matches(java.io.File file)
          Return true if this TrackReader matches the File
abstract  FieldMap read(java.io.File file)
          Load and parse the file and return a FieldMap with its fields
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.qtunes.core.Service
getContext, reportState, startService, stopService
 

Field Detail

MP3GENRES

public static final java.lang.String[] MP3GENRES
Constructor Detail

TrackReader

public TrackReader()
Method Detail

getAudioInputStream

public abstract javax.sound.sampled.AudioInputStream getAudioInputStream(java.io.File file)
                                                                  throws javax.sound.sampled.UnsupportedAudioFileException,
                                                                         java.io.IOException
Return the AudioInputStream for the specified File. We use this approach because it's more reliable than relying on the AudioSystem to correctly identify the file.

Throws:
javax.sound.sampled.UnsupportedAudioFileException
java.io.IOException

getType

public abstract java.lang.String getType()
Get the type of track read by this reader, eg "mp3". Must match the "Type" field of the FieldMap read by this reader


matches

public abstract boolean matches(java.io.File file)
Return true if this TrackReader matches the File


read

public abstract FieldMap read(java.io.File file)
                       throws java.io.IOException
Load and parse the file and return a FieldMap with its fields

Throws:
java.io.IOException

getTrackReader

public static final TrackReader getTrackReader(ServiceContext context,
                                               java.lang.String type)
Return the appropriate TracKReader for the specified type


getTrackReader

public static final TrackReader getTrackReader(ServiceContext context,
                                               java.io.File file)
                                        throws java.io.IOException
Return the appropriate TracKReader for the specified file

Throws:
java.io.IOException

getTrackReader

public static final TrackReader getTrackReader(java.io.File file)
                                        throws java.io.IOException
Return the appropriate TracKReader for the specified file - the list of readers is built in and no context is required

Throws:
java.io.IOException

getTrackReader

public static final TrackReader getTrackReader(java.lang.String type)