FileDocCategorySizeDatePackage
MediaFile.javaAPI Docjid3 0.464198Tue Nov 22 02:10:41 GMT 2005org.blinkenlights.jid3

MediaFile

public abstract class MediaFile extends Object
author
paul The base class for all files which can contain ID3 tags.

Fields Summary
protected IFileSource
m_oFileSource
protected ID3V1Tag
m_oID3V1Tag
protected ID3V2Tag
m_oID3V2Tag
Constructors Summary
public MediaFile(File oSourceFile)
Constructor for a media file object, representing a given file.

param
oSourceFile the file which this object represents


                           
      
    
        m_oFileSource = new FileSource(oSourceFile);
    
public MediaFile(IFileSource oFileSource)

        m_oFileSource = oFileSource;
    
Methods Summary
public abstract ID3V1TaggetID3V1Tag()
Get the ID3 V1 tag from this file.

return
a V1 tag object, if V1 tags are contained in the file
throws
ID3Exception if there is an error reading the file

public abstract ID3V2TaggetID3V2Tag()
Get the ID3 V2 tag from this file.

return
a V2 tag object, if V2 tags are contained in the file
throws
ID3Exception if there is an error reading the file

public abstract ID3Tag[]getTags()
Get any tags stored in the file.

return
an array of tags which are contained in the file
throws
ID3Exception if there is any error reading the file

public abstract voidremoveID3V1Tag()
Remove V1 tags from this file if present.

throws
ID3Exception if there is an error processing the file

public abstract voidremoveID3V2Tag()
Remove V2 tags from this file if present.

throws
ID3Exception if there is an error processing the file

public abstract voidremoveTags()
Remove both V1 and V2 tags from this file if present.

throws
ID3Exception if there is an error processing the file

public ID3TagsetID3Tag(ID3Tag oID3Tag)
Set an ID3 tag in this object. Note this method does not cause the contents of the actual file to be modified.

param
oID3Tag tag to be set for this media file
return
If any tags were overwritten by the new tags, they are returned. Otherwise, null is returned.

        if (oID3Tag instanceof ID3V1Tag)
        {
            ID3V1Tag oOldID3V1Tag = m_oID3V1Tag;
            m_oID3V1Tag = (ID3V1Tag)oID3Tag;
            
            return oOldID3V1Tag;
        }
        else if (oID3Tag instanceof ID3V2Tag)
        {
            ID3V2Tag oOldID3V2Tag = m_oID3V2Tag;
            m_oID3V2Tag = (ID3V2Tag)oID3Tag;
            
            return oOldID3V2Tag;
        }
        
        return null;
    
public abstract voidsync()
Update the actual file to reflect the current state of the tags as set in this object.

throws
ID3Exception if an error occurs updating the file