org.farng.mp3.id3
Class AbstractID3v2

java.lang.Object
  extended by org.farng.mp3.AbstractMP3FileItem
      extended by org.farng.mp3.AbstractMP3Tag
          extended by org.farng.mp3.id3.AbstractID3
              extended by org.farng.mp3.id3.AbstractID3v2
All Implemented Interfaces:
MP3Tag
Direct Known Subclasses:
ID3v2_2

public abstract class AbstractID3v2
extends AbstractID3

Superclass for all ID3v2 tags

Version:
$Revision: 3 $
Author:
Eric Farng

Constructor Summary
protected AbstractID3v2()
          Creates a new AbstractID3v2 object.
protected AbstractID3v2(AbstractID3v2 copyObject)
          Creates a new AbstractID3v2 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.
protected  void appendDuplicateFrameId(java.lang.String duplicateFrameId)
           
protected static int byteArrayToSize(byte[] buffer)
           
 void clearFrameMap()
           
protected static void decrementPaddingCounter()
           
 void delete(java.io.RandomAccessFile file)
          removes the specific tag the easiest way.
 boolean equals(java.lang.Object obj)
          Determines whether another object is equal to this tag.
 int getDuplicateBytes()
           
 java.lang.String getDuplicateFrameId()
           
 int getEmptyFrameBytes()
           
 int getFileReadBytes()
           
 AbstractID3v2Frame getFrame(java.lang.String identifier)
           
 int getFrameCount()
           
 java.util.Iterator getFrameIterator()
           
 java.util.Iterator getFrameOfType(java.lang.String identifier)
           
 int getInvalidFrameBytes()
           
 byte getMajorVersion()
           
protected static int getPaddingCounter()
           
 int getPaddingSize()
           
 byte getRevision()
           
 boolean hasFrame(java.lang.String identifier)
           
 boolean hasFrameOfType(java.lang.String identifier)
           
protected  void incrementDuplicateBytes(int duplicateBytes)
           
protected  void incrementEmptyFrameBytes(int emptyFrameBytes)
           
protected  void incrementInvalidFrameBytes()
           
protected static void incrementPaddingCounter()
           
 java.util.Iterator<MP3MetadataItem> 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 removeFrame(java.lang.String identifier)
           
 void removeFrameOfType(java.lang.String identifier)
           
protected static void resetPaddingCounter()
           
protected  void setFileReadBytes(int fileReadSize)
           
 void setFrame(AbstractID3v2Frame frame)
           
protected  void setMajorVersion(byte majorVersion)
           
protected  void setPaddingSize(int paddingSize)
           
protected  void setRevision(byte revision)
           
protected static byte[] sizeToByteArray(int size)
           
 java.util.Collection values()
           
 void write(AbstractMP3Tag abstractMP3Tag)
          This method does nothing, but is called by subclasses for completeness
 
Methods inherited from class org.farng.mp3.AbstractMP3Tag
isSubsetOf, seek, setAlbumTitle, setAuthorComposer, setLeadArtist, setSongComment, setSongGenre, setSongLyric, setSongTitle, setTrackNumberOnAlbum, setYearReleased
 
Methods inherited from class org.farng.mp3.AbstractMP3FileItem
getIdentifier, getSize, isSubsetOf, read, write
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.farng.mp3.MP3Tag
getAlbumTitle, getAuthorComposer, getLeadArtist, getSongComment, getSongGenre, getSongLyric, getSongTitle, getTrackNumberOnAlbum, getYearReleased
 

Constructor Detail

AbstractID3v2

protected AbstractID3v2()
Creates a new AbstractID3v2 object.


AbstractID3v2

protected AbstractID3v2(AbstractID3v2 copyObject)
Creates a new AbstractID3v2 object.

Method Detail

setFrame

public void setFrame(AbstractID3v2Frame frame)

getFrame

public AbstractID3v2Frame getFrame(java.lang.String identifier)

getFrameCount

public int getFrameCount()

clearFrameMap

public void clearFrameMap()

getFrameIterator

public java.util.Iterator getFrameIterator()

getFrameOfType

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

hasFrame

public boolean hasFrame(java.lang.String identifier)

hasFrameOfType

public boolean hasFrameOfType(java.lang.String identifier)

iterator

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

Returns:
iterator

removeFrame

public void removeFrame(java.lang.String identifier)

removeFrameOfType

public void removeFrameOfType(java.lang.String identifier)

values

public java.util.Collection values()

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

delete

public void delete(java.io.RandomAccessFile file)
            throws java.io.IOException
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.
Throws:
java.io.IOException - on any I/O error

equals

public boolean equals(java.lang.Object obj)
Description copied from class: AbstractMP3Tag
Determines whether another object is equal to this tag. It just compares if they are the same class, then calls super.equals(object).

Overrides:
equals in class AbstractMP3Tag
Parameters:
obj - object to determine equality of
Returns:
true if this object and its body are equal

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 java.io.IOException,
                      TagException
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.

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

byteArrayToSize

protected static int byteArrayToSize(byte[] buffer)

sizeToByteArray

protected static byte[] sizeToByteArray(int size)

resetPaddingCounter

protected static void resetPaddingCounter()

incrementPaddingCounter

protected static void incrementPaddingCounter()

decrementPaddingCounter

protected static void decrementPaddingCounter()

getPaddingCounter

protected static int getPaddingCounter()

getMajorVersion

public byte getMajorVersion()

setMajorVersion

protected void setMajorVersion(byte majorVersion)

getRevision

public byte getRevision()

setRevision

protected void setRevision(byte revision)

getDuplicateBytes

public int getDuplicateBytes()

getDuplicateFrameId

public java.lang.String getDuplicateFrameId()

getEmptyFrameBytes

public int getEmptyFrameBytes()

getFileReadBytes

public int getFileReadBytes()

setFileReadBytes

protected void setFileReadBytes(int fileReadSize)

setPaddingSize

protected void setPaddingSize(int paddingSize)

incrementDuplicateBytes

protected void incrementDuplicateBytes(int duplicateBytes)

incrementEmptyFrameBytes

protected void incrementEmptyFrameBytes(int emptyFrameBytes)

incrementInvalidFrameBytes

protected void incrementInvalidFrameBytes()

appendDuplicateFrameId

protected void appendDuplicateFrameId(java.lang.String duplicateFrameId)

getInvalidFrameBytes

public int getInvalidFrameBytes()

getPaddingSize

public int getPaddingSize()