org.metasyntactic.utilities
Class Tagger

java.lang.Object
  |
  +--org.metasyntactic.utilities.Tagger

public abstract class Tagger
extends java.lang.Object


Field Summary
protected  java.io.File file
           
protected  boolean mergeTags
          If the file already has a tag that contains more information then this tag, keep that extra info
protected  Tag tag
           
 
Constructor Summary
Tagger(java.io.File file, Tag tag)
           
 
Method Summary
 boolean addTag()
          Add this tag to this file In general if the tag must be added to the beginning the streams must be used, otherwise it is advisable to implement this with RandomAccessFile to save i/o time
protected abstract  boolean checkForTag()
          Does the file already have a tag? Note: In this design checkForTag checks for tags of the same type as the tag to be added
 java.io.File getFile()
           
 Tag getTag()
           
protected abstract  boolean hasThisTag()
          Is the tag this file has identical to this tag?
protected abstract  void mergeTags()
           
protected abstract  boolean overwriteTag()
          If the current tag can be overwritten (id3v1, or id3v2 with buffers) then use this method.
abstract  boolean removeTag()
          Remove all the If the tag supports buffers (like Id3v2) it is recommended that you replace the tag with an empty (full buffer) tag.
 void setFile(java.io.File file)
           
 void setTag(Tag tag)
           
protected abstract  boolean tagHasMoreInformation()
          Does the file's current tag contain all the information in this tag and even more?
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

file

protected java.io.File file

tag

protected Tag tag

mergeTags

protected boolean mergeTags
If the file already has a tag that contains more information then this tag, keep that extra info

Constructor Detail

Tagger

public Tagger(java.io.File file,
              Tag tag)
Method Detail

getFile

public java.io.File getFile()

getTag

public Tag getTag()

setFile

public void setFile(java.io.File file)

setTag

public void setTag(Tag tag)

checkForTag

protected abstract boolean checkForTag()
Does the file already have a tag? Note: In this design checkForTag checks for tags of the same type as the tag to be added


hasThisTag

protected abstract boolean hasThisTag()
Is the tag this file has identical to this tag?


tagHasMoreInformation

protected abstract boolean tagHasMoreInformation()
Does the file's current tag contain all the information in this tag and even more?


mergeTags

protected abstract void mergeTags()

addTag

public boolean addTag()
               throws java.io.IOException
Add this tag to this file In general if the tag must be added to the beginning the streams must be used, otherwise it is advisable to implement this with RandomAccessFile to save i/o time

Returns:
true/false depending on if the add was successful
java.io.IOException

removeTag

public abstract boolean removeTag()
Remove all the If the tag supports buffers (like Id3v2) it is recommended that you replace the tag with an empty (full buffer) tag. This eases disk usage over using streams, and means that if a tag is later added RandomAccessFile can be used instead of streams

Returns:
true/false depending on if the removal was successful

overwriteTag

protected abstract boolean overwriteTag()
If the current tag can be overwritten (id3v1, or id3v2 with buffers) then use this method. Otherwise, this method should eitehr do nothing, or possibly call removeTag() and then addTag()

Returns:
true/false if the overwrite was successful