|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.generic.AudioFileWriter
public abstract class AudioFileWriter
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.
Field Summary | |
---|---|
static java.util.logging.Logger |
logger
|
private static int |
MINIMUM_FILESIZE
|
private AudioFileModificationListener |
modificationListener
If not null , this listener is used to notify the listener
about modification events. |
private static java.lang.String |
TEMP_FILENAME_SUFFIX
|
private static java.lang.String |
WRITE_MODE
|
Constructor Summary | |
---|---|
AudioFileWriter()
|
Method Summary | |
---|---|
void |
delete(AudioFile af)
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. |
protected abstract void |
deleteTag(java.io.RandomAccessFile raf,
java.io.RandomAccessFile tempRaf)
Same as above, but delete tag in the file. |
private void |
precheckWrite(AudioFile af)
Prechecks before normal write If the tag is actually empty, remove the tag if the file is not writable, throw exception If the file is too small to be a valid file, throw exception |
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 |
protected abstract void |
writeTag(Tag tag,
java.io.RandomAccessFile raf,
java.io.RandomAccessFile rafTemp)
This is called when a tag has to be written in a file. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final java.lang.String TEMP_FILENAME_SUFFIX
private static final java.lang.String WRITE_MODE
private static final int MINIMUM_FILESIZE
public static java.util.logging.Logger logger
private AudioFileModificationListener modificationListener
null
, this listener is used to notify the listener
about modification events.
Constructor Detail |
---|
public AudioFileWriter()
Method Detail |
---|
public void delete(AudioFile af) throws CannotReadException, CannotWriteException
af
- The file to process
CannotWriteException
- if anything went wrong
CannotReadException
public void delete(java.io.RandomAccessFile raf, java.io.RandomAccessFile tempRaf) throws CannotReadException, CannotWriteException, java.io.IOException
raf
- The source file, already opened in r-write modetempRaf
- The temporary file opened in r-write mode
CannotWriteException
- if anything went wrong
CannotReadException
java.io.IOException
protected abstract void deleteTag(java.io.RandomAccessFile raf, java.io.RandomAccessFile tempRaf) throws CannotReadException, CannotWriteException, java.io.IOException
raf
- tempRaf
-
java.io.IOException
- is thrown when the RandomAccessFile operations throw it (you
should never throw them manually)
CannotWriteException
- when an error occured during the deletion of the tag
CannotReadException
public void setAudioFileModificationListener(AudioFileModificationListener listener)
AudioFileModificationListener
.ModificationHandler
to broadcast those events.
listener
- The listener. null
allowed to deregister.private void precheckWrite(AudioFile af) throws CannotWriteException
af
-
CannotWriteException
public void write(AudioFile af) throws CannotWriteException
af
- The file we want to process
CannotWriteException
- if anything went wrongprotected abstract void writeTag(Tag tag, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp) throws CannotReadException, CannotWriteException, java.io.IOException
tag
- raf
- rafTemp
-
java.io.IOException
- is thrown when the RandomAccessFile operations throw it (you
should never throw them manually)
CannotWriteException
- when an error occured during the generation of the tag
CannotReadException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |