org.blinkenlights.jid3
Class MediaFile

java.lang.Object
  extended byorg.blinkenlights.jid3.MediaFile
Direct Known Subclasses:
MP3File

public abstract class MediaFile
extends java.lang.Object


Field Summary
protected  IFileSource m_oFileSource
           
protected  ID3V1Tag m_oID3V1Tag
           
protected  ID3V2Tag m_oID3V2Tag
           
 
Constructor Summary
MediaFile(java.io.File oSourceFile)
          Constructor for a media file object, representing a given file.
MediaFile(IFileSource oFileSource)
           
 
Method Summary
abstract  ID3V1Tag getID3V1Tag()
          Get the ID3 V1 tag from this file.
abstract  ID3V2Tag getID3V2Tag()
          Get the ID3 V2 tag from this file.
abstract  ID3Tag[] getTags()
          Get any tags stored in the file.
abstract  void removeID3V1Tag()
          Remove V1 tags from this file if present.
abstract  void removeID3V2Tag()
          Remove V2 tags from this file if present.
abstract  void removeTags()
          Remove both V1 and V2 tags from this file if present.
 ID3Tag setID3Tag(ID3Tag oID3Tag)
          Set an ID3 tag in this object.
abstract  void sync()
          Update the actual file to reflect the current state of the tags as set in this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_oFileSource

protected IFileSource m_oFileSource

m_oID3V1Tag

protected ID3V1Tag m_oID3V1Tag

m_oID3V2Tag

protected ID3V2Tag m_oID3V2Tag
Constructor Detail

MediaFile

public MediaFile(java.io.File oSourceFile)
Constructor for a media file object, representing a given file.

Parameters:
oSourceFile - the file which this object represents

MediaFile

public MediaFile(IFileSource oFileSource)
Method Detail

sync

public abstract void sync()
                   throws ID3Exception
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

getTags

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

Returns:
an array of tags which are contained in the file
Throws:
ID3Exception - if there is any error reading the file

getID3V1Tag

public abstract ID3V1Tag getID3V1Tag()
                              throws ID3Exception
Get the ID3 V1 tag from this file.

Returns:
a V1 tag object, if V1 tags are contained in the file
Throws:
ID3Exception - if there is an error reading the file

getID3V2Tag

public abstract ID3V2Tag getID3V2Tag()
                              throws ID3Exception
Get the ID3 V2 tag from this file.

Returns:
a V2 tag object, if V2 tags are contained in the file
Throws:
ID3Exception - if there is an error reading the file

removeTags

public abstract void removeTags()
                         throws ID3Exception
Remove both V1 and V2 tags from this file if present.

Throws:
ID3Exception - if there is an error processing the file

removeID3V1Tag

public abstract void removeID3V1Tag()
                             throws ID3Exception
Remove V1 tags from this file if present.

Throws:
ID3Exception - if there is an error processing the file

removeID3V2Tag

public abstract void removeID3V2Tag()
                             throws ID3Exception
Remove V2 tags from this file if present.

Throws:
ID3Exception - if there is an error processing the file

setID3Tag

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

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