org.farng.mp3.filename
Class FilenameTag

java.lang.Object
  extended by org.farng.mp3.AbstractMP3FileItem
      extended by org.farng.mp3.AbstractMP3Tag
          extended by org.farng.mp3.filename.FilenameTag
All Implemented Interfaces:
MP3Tag

public class FilenameTag
extends AbstractMP3Tag

This class represents the filename. To create it, invoke FilenameTagBuilder.createFilenameTagFromMP3File which returns a complete parsed, evaluated, and matched FilenameTag.

Version:
$Revision: 3 $
Author:
Eric Farng

Constructor Summary
protected FilenameTag()
          Creates a new FilenameTag object.
  FilenameTag(FilenameTag copyObject)
          Creates a new FilenameTag object.
 
Method Summary
 void append(AbstractMP3Tag abstractMP3Tag)
          This method does nothing, but is called by subclasses for completeness
 void append(java.io.RandomAccessFile file)
          Appends this tag to the given file.
 java.lang.String composeFilename()
           
 void delete(java.io.RandomAccessFile file)
          removes the specific tag the easiest way.
 java.lang.String getAlbumTitle()
          Get the song's album title.
 java.lang.String getAuthorComposer()
          Get the author/composer.
 AbstractFilenameComposite getComposite()
          Returns the composite that this tag will use.
 java.lang.String getExtension()
           
 AbstractID3v2Frame getFrame(java.lang.String identifier)
          Returns a frame of this tag
 java.util.Iterator getFrameOfType(java.lang.String identifier)
           
 ID3v2_4 getId3tag()
          Returns the ID3v2_4 representation of this tag
 java.lang.String getIdentifier()
           
 java.lang.String getLeadArtist()
          Get the lead artist.
 MP3File getMp3file()
           
 int getSize()
           
 java.lang.String getSongComment()
          Get a song comment.
 java.lang.String getSongGenre()
          Get the genre.
 java.lang.String getSongLyric()
          Get the song lyrics.
 java.lang.String getSongTitle()
          Get the song title.
 java.lang.String getTrackNumberOnAlbum()
          Get the track number.
 java.lang.String getYearReleased()
          Get the year the song was released.
 boolean hasFrame(java.lang.String identifier)
           
 boolean hasFrameOfType(java.lang.String identifier)
           
 java.util.Iterator iterator()
          Get an iterator over all tags available.
 void overwrite(AbstractMP3Tag abstractMP3Tag)
          This method does nothing, but is called by subclasses for completeness
 void overwrite(java.io.RandomAccessFile file)
          Overwrites this tag to the given file.
 void read(java.io.RandomAccessFile file)
          import java.io.IOException; import java.io.RandomAccessFile; read from current file pointer position.
 boolean seek(java.io.RandomAccessFile file)
          Looks for this tag.
 void setAlbumTitle(java.lang.String albumTitle)
           
 void setAuthorComposer(java.lang.String authorComposer)
           
 void setComposite(AbstractFilenameComposite composite)
          Sets the composite that this tag will use.
 void setExtension(java.lang.String extension)
           
 void setFrame(AbstractID3v2Frame frame)
          Sets the frame of this tag
 void setId3tag(ID3v2_4 id3tag)
          Sets the ID3v2_4 representation of this tag.
 void setLeadArtist(java.lang.String leadArtist)
           
 void setMp3file(MP3File mp3file)
           
 void setSongComment(java.lang.String songComment)
           
 void setSongGenre(java.lang.String songGenre)
           
 void setSongLyric(java.lang.String songLyrics)
           
 void setSongTitle(java.lang.String songTitle)
           
 void setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
           
 void setYearReleased(java.lang.String yearReleased)
           
 java.lang.String toString()
           
 void write(AbstractMP3Tag abstractMP3Tag)
          This method does nothing, but is called by subclasses for completeness
 void write(java.io.RandomAccessFile file)
          Method to write this object to the file argument at is current file pointer position.
 
Methods inherited from class org.farng.mp3.AbstractMP3Tag
equals, isSubsetOf
 
Methods inherited from class org.farng.mp3.AbstractMP3FileItem
isSubsetOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FilenameTag

public FilenameTag(FilenameTag copyObject)
Creates a new FilenameTag object.


FilenameTag

protected FilenameTag()
Creates a new FilenameTag object.

Method Detail

setComposite

public void setComposite(AbstractFilenameComposite composite)
Sets the composite that this tag will use.

Parameters:
composite - the composite that this tag will use.

getComposite

public AbstractFilenameComposite getComposite()
Returns the composite that this tag will use.

Returns:
the composite that this tag will use.

setExtension

public void setExtension(java.lang.String extension)

getExtension

public java.lang.String getExtension()

setFrame

public void setFrame(AbstractID3v2Frame frame)
Sets the frame of this tag

Parameters:
frame - the frame to set

getFrame

public AbstractID3v2Frame getFrame(java.lang.String identifier)
Returns a frame of this tag

Parameters:
identifier - ID3v2_4 ID of frame to get
Returns:
a frame of this tag

getFrameOfType

public java.util.Iterator getFrameOfType(java.lang.String identifier)

setId3tag

public void setId3tag(ID3v2_4 id3tag)
Sets the ID3v2_4 representation of this tag.

Parameters:
id3tag - the ID3v2_4 representation of this tag

getId3tag

public ID3v2_4 getId3tag()
Returns the ID3v2_4 representation of this tag

Returns:
the ID3v2_4 representation of this tag

getIdentifier

public java.lang.String getIdentifier()
Specified by:
getIdentifier in class AbstractMP3FileItem

setMp3file

public void setMp3file(MP3File mp3file)

getMp3file

public MP3File getMp3file()

getSize

public int getSize()
Specified by:
getSize in class AbstractMP3FileItem

append

public void append(AbstractMP3Tag abstractMP3Tag)
Description copied from class: AbstractMP3Tag
This method does nothing, but is called by subclasses for completeness

Specified by:
append in class AbstractMP3Tag
Parameters:
abstractMP3Tag - tag to overwrite

append

public void append(java.io.RandomAccessFile file)
Description copied from class: AbstractMP3Tag
Appends this tag to the given file. Append means any information this tag contains will be added to the file's corresponding tag, but it will not replace any fields that the file already has. If the file does not have this specific tag, a new one will be created.

Specified by:
append in class AbstractMP3Tag
Parameters:
file - MP3 file to append to.

composeFilename

public java.lang.String composeFilename()

delete

public void delete(java.io.RandomAccessFile file)
Description copied from class: AbstractMP3Tag
removes the specific tag the easiest way.
ID3v1 - cuts the length of the tag
lyrics3 -cuts the length of the tag, then writes the id3v1 tag if it existed
id3v2 - just overwrites the ID3 tag indicator at the start of the tag

Specified by:
delete in class AbstractMP3Tag
Parameters:
file - MP3 file to append to.

hasFrame

public boolean hasFrame(java.lang.String identifier)

hasFrameOfType

public boolean hasFrameOfType(java.lang.String identifier)

iterator

public java.util.Iterator iterator()
Description copied from interface: MP3Tag
Get an iterator over all tags available.

Returns:
iterator

overwrite

public void overwrite(AbstractMP3Tag abstractMP3Tag)
Description copied from class: AbstractMP3Tag
This method does nothing, but is called by subclasses for completeness

Specified by:
overwrite in class AbstractMP3Tag
Parameters:
abstractMP3Tag - tag to overwrite

overwrite

public void overwrite(java.io.RandomAccessFile file)
               throws TagException,
                      java.io.IOException
Description copied from class: AbstractMP3Tag
Overwrites this tag to the given file. Overwrite means any information this tag contains will replace any existing fields in the file's corresponding tag. If the file does not have this specific tag, a new one will be created.

Specified by:
overwrite in class AbstractMP3Tag
Parameters:
file - MP3 file to overwrite
Throws:
TagException - on any exception generated by this library.
java.io.IOException - on any I/O error

read

public void read(java.io.RandomAccessFile file)
Description copied from class: AbstractMP3FileItem
import java.io.IOException; import java.io.RandomAccessFile; read from current file pointer position.

Specified by:
read in class AbstractMP3FileItem
Parameters:
file - file to read from

seek

public boolean seek(java.io.RandomAccessFile file)
Description copied from class: AbstractMP3Tag
Looks for this tag. returns true if found. If found, the file pointer is right after the tag start indicator i.e. "TAG" "LYRICSBEGIN" "ID3" + 2

Specified by:
seek in class AbstractMP3Tag
Parameters:
file - MP3 file to overwrite
Returns:
returns true if found, false otherwise.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

write

public void write(AbstractMP3Tag abstractMP3Tag)
Description copied from class: AbstractMP3Tag
This method does nothing, but is called by subclasses for completeness

Specified by:
write in class AbstractMP3Tag
Parameters:
abstractMP3Tag - tag to write to

write

public void write(java.io.RandomAccessFile file)
           throws java.io.IOException,
                  TagException
Description copied from class: AbstractMP3FileItem
Method to write this object to the file argument at is current file pointer position.

Specified by:
write in class AbstractMP3FileItem
Parameters:
file - file to write to
Throws:
java.io.IOException - on any I/O error
TagException

getSongTitle

public java.lang.String getSongTitle()
Description copied from interface: MP3Tag
Get the song title.

Returns:
song title

getLeadArtist

public java.lang.String getLeadArtist()
Description copied from interface: MP3Tag
Get the lead artist.

Returns:
lead artist

getAlbumTitle

public java.lang.String getAlbumTitle()
Description copied from interface: MP3Tag
Get the song's album title.

Returns:
album title

getYearReleased

public java.lang.String getYearReleased()
Description copied from interface: MP3Tag
Get the year the song was released.

Returns:
year

getSongComment

public java.lang.String getSongComment()
Description copied from interface: MP3Tag
Get a song comment.

Returns:
comment

getSongGenre

public java.lang.String getSongGenre()
Description copied from interface: MP3Tag
Get the genre.

Returns:
genre

getTrackNumberOnAlbum

public java.lang.String getTrackNumberOnAlbum()
Description copied from interface: MP3Tag
Get the track number.

Returns:
track number

getSongLyric

public java.lang.String getSongLyric()
Description copied from interface: MP3Tag
Get the song lyrics.

Returns:
song lyrics

getAuthorComposer

public java.lang.String getAuthorComposer()
Description copied from interface: MP3Tag
Get the author/composer.

Returns:
author/composer

setSongTitle

public void setSongTitle(java.lang.String songTitle)
Specified by:
setSongTitle in class AbstractMP3Tag

setLeadArtist

public void setLeadArtist(java.lang.String leadArtist)
Specified by:
setLeadArtist in class AbstractMP3Tag

setAlbumTitle

public void setAlbumTitle(java.lang.String albumTitle)
Specified by:
setAlbumTitle in class AbstractMP3Tag

setYearReleased

public void setYearReleased(java.lang.String yearReleased)
Specified by:
setYearReleased in class AbstractMP3Tag

setSongComment

public void setSongComment(java.lang.String songComment)
Specified by:
setSongComment in class AbstractMP3Tag

setSongGenre

public void setSongGenre(java.lang.String songGenre)
Specified by:
setSongGenre in class AbstractMP3Tag

setTrackNumberOnAlbum

public void setTrackNumberOnAlbum(java.lang.String trackNumberOnAlbum)
Specified by:
setTrackNumberOnAlbum in class AbstractMP3Tag

setSongLyric

public void setSongLyric(java.lang.String songLyrics)
Specified by:
setSongLyric in class AbstractMP3Tag

setAuthorComposer

public void setAuthorComposer(java.lang.String authorComposer)
Specified by:
setAuthorComposer in class AbstractMP3Tag