public abstract class AudioFileWriter
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private static java.lang.String |
FILE_NAME_TOO_LONG |
private static int |
FILE_NAME_TOO_LONG_SAFE_LIMIT |
private static java.lang.String |
FILE_NAME_TOO_LONG2 |
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 and Description |
---|
AudioFileWriter() |
Modifier and Type | Method and Description |
---|---|
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.
|
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 static final java.lang.String FILE_NAME_TOO_LONG
private static final java.lang.String FILE_NAME_TOO_LONG2
private static final int FILE_NAME_TOO_LONG_SAFE_LIMIT
private AudioFileModificationListener modificationListener
null
, this listener is used to notify the listener
about modification events.public void delete(AudioFile af) throws CannotReadException, CannotWriteException
af
- The file to processCannotWriteException
- if anything went wrongCannotReadException
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 modeCannotWriteException
- if anything went wrongCannotReadException
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 tagCannotReadException
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 processCannotWriteException
- 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 tagCannotReadException
Copyright © 2005-2013 java.net. All Rights Reserved.