|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectcomp202.fall2007.a5.util.SongFactory
public class SongFactory
A SongFactory
enables the easy creation of Song
objects representing digital audio tracks stored on disk. The created
Song
objects's attributes are initialized using the values
stored in the metadata (ID3) tags stored in the file.
Constructor Summary | |
---|---|
SongFactory()
Creates a new SongFactory . |
Method Summary | |
---|---|
Song |
createSong(String path)
Creates a new Song object representing the MP3 audio track
stored in the file given by the specified String . |
static void |
disableLogging()
Disable the Loggers used and created by the Jaudiotagger
libraries. |
static void |
enableLogging()
Enable the Logger s used and created by the Jaudiotagger
libraries. |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SongFactory()
SongFactory
.
Method Detail |
---|
public Song createSong(String path) throws java.io.IOException, java.io.FileNotFoundException, IncorrectFileExtensionException
Creates a new Song
object representing the MP3 audio track
stored in the file given by the specified String
.
The length attribute of the new Song
object is initialized
from the audio header of the MP3 file, and the disc number attribute is
always 1
.
To initialize the artist, album, title and track number attributes of the
new Song
object, the method determines whether the MP3
file contains an ID3 V2 tag. If it does, then the aforementioned
attributes of the new Song
object are initialized using
the data stored in this tag. Otherwise, the method determines whether the
MP3 file contains an ID3 V1 tag; if it does, the aforementioned
attributes are initialized using the data stored in this tag, otherwise,
they are assigned default values.
The default value for the artist, album, and title attributes is the
empty String
, while the default value for the track
number attribute is Song.EMPTY_TRACK
. Note that if a tag
is present, but one of the fields corresponding to the artist, album,
title, or track number attribute is empty, the corresponding attribute in
returned Song
object is assigned the default value.
path
- The path of the MP3 file which contains the audio track to be
represented by the returned Song
.
Song
objects whose attributes are
initialized using values read from the file given by
path
.
java.io.IOException
- if there was an error reading the file specified by
path
.
java.io.FileNotFoundException
- if the file specified by path
does not exist.
IncorrectFileExtensionException
- if the file specified by path
does not have
extension .MP3 (or case variations thereof).public static void enableLogging()
Logger
s used and created by the Jaudiotagger
libraries.
Logging is disabled by default.
public static void disableLogging()
Loggers
used and created by the Jaudiotagger
libraries.
Logging is disabled by default.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |