org.jaudiotagger.audio.generic
Class AudioFileWriter

java.lang.Object
  extended by org.jaudiotagger.audio.generic.AudioFileWriter
Direct Known Subclasses:
AsfFileWriter, FlacFileWriter, MP3FileWriter, Mp4FileWriter, OggFileWriter

public abstract class AudioFileWriter
extends java.lang.Object

This abstract class is the skeleton for tag writers.

It handles the creation/closing of the randomaccessfile objects and then call the subclass method writeTag or deleteTag. These two method have to be implemented in the subclass.

Since:
v0.02
Version:
$Id: AudioFileWriter.java,v 1.6 2007/11/23 14:35:42 paultaylor Exp $
Author:
Raphael Slinckx

Field Summary
static java.util.logging.Logger logger
           
 
Constructor Summary
AudioFileWriter()
           
 
Method Summary
 void delete(AudioFile f)
          Delete the tag (if any) present in the given file
 void delete(java.io.RandomAccessFile raf, java.io.RandomAccessFile tempRaf)
          Delete the tag (if any) present in the given randomaccessfile, and do not close it at the end.
 void setAudioFileModificationListener(AudioFileModificationListener listener)
          This method sets the AudioFileModificationListener.
There is only one listener allowed, if you want more instances to be supported, use the ModificationHandler to broadcast those events.
 void write(AudioFile af)
          Write the tag (if not empty) present in the AudioFile in the associated File
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger
Constructor Detail

AudioFileWriter

public AudioFileWriter()
Method Detail

delete

public void delete(AudioFile f)
            throws CannotReadException,
                   CannotWriteException
Delete the tag (if any) present in the given file

Parameters:
f - The file to process
Throws:
CannotWriteException - if anything went wrong
CannotReadException

delete

public void delete(java.io.RandomAccessFile raf,
                   java.io.RandomAccessFile tempRaf)
            throws CannotReadException,
                   CannotWriteException,
                   java.io.IOException
Delete the tag (if any) present in the given randomaccessfile, and do not close it at the end.

Parameters:
raf - The source file, already opened in r-write mode
tempRaf - The temporary file opened in r-write mode
Throws:
CannotWriteException - if anything went wrong
CannotReadException
java.io.IOException

setAudioFileModificationListener

public void setAudioFileModificationListener(AudioFileModificationListener listener)
This method sets the AudioFileModificationListener.
There is only one listener allowed, if you want more instances to be supported, use the ModificationHandler to broadcast those events.

Parameters:
listener - The listener. null allowed to deregister.

write

public void write(AudioFile af)
           throws CannotWriteException
Write the tag (if not empty) present in the AudioFile in the associated File

Parameters:
af - The file we want to process
Throws:
CannotWriteException - if anything went wrong