org.farng.mp3.filename
Class FilenameTag

java.lang.Object
  extended byorg.farng.mp3.AbstractMP3FileItem
      extended byorg.farng.mp3.AbstractMP3Tag
          extended byorg.farng.mp3.filename.FilenameTag

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: 1.5 $
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()
           
 java.lang.String getAuthorComposer()
           
 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()
          ID string that usually corresponds to the class name, but can be displayed to the user.
 java.lang.String getLeadArtist()
           
 MP3File getMp3file()
           
 int getSize()
           
 java.lang.String getSongComment()
           
 java.lang.String getSongGenre()
           
 java.lang.String getSongLyric()
           
 java.lang.String getSongTitle()
           
 java.lang.String getTrackNumberOnAlbum()
           
 java.lang.String getYearReleased()
           
 boolean hasFrame(java.lang.String identifier)
           
 boolean hasFrameOfType(java.lang.String identifier)
           
 java.util.Iterator iterator()
           
 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()
Description copied from class: AbstractMP3FileItem
ID string that usually corresponds to the class name, but can be displayed to the user. It is not indended to identify each individual instance.

Specified by:
getIdentifier in class AbstractMP3FileItem
Returns:
ID string

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()
Specified by:
iterator in class AbstractMP3Tag

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:
java.io.IOException - on any I/O error
TagException - on any exception generated by this library.

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()

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()
Specified by:
getSongTitle in class AbstractMP3Tag

getLeadArtist

public java.lang.String getLeadArtist()
Specified by:
getLeadArtist in class AbstractMP3Tag

getAlbumTitle

public java.lang.String getAlbumTitle()
Specified by:
getAlbumTitle in class AbstractMP3Tag

getYearReleased

public java.lang.String getYearReleased()
Specified by:
getYearReleased in class AbstractMP3Tag

getSongComment

public java.lang.String getSongComment()
Specified by:
getSongComment in class AbstractMP3Tag

getSongGenre

public java.lang.String getSongGenre()
Specified by:
getSongGenre in class AbstractMP3Tag

getTrackNumberOnAlbum

public java.lang.String getTrackNumberOnAlbum()
Specified by:
getTrackNumberOnAlbum in class AbstractMP3Tag

getSongLyric

public java.lang.String getSongLyric()
Specified by:
getSongLyric in class AbstractMP3Tag

getAuthorComposer

public java.lang.String getAuthorComposer()
Specified by:
getAuthorComposer in class AbstractMP3Tag

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


Copyright (c) 2004 Eric Farng