| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| AudioFileModificationListener |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Entagged Audio Tag library | |
| 3 | * Copyright (c) 2003-2005 Christian Laireiter <liree@web.de> | |
| 4 | * | |
| 5 | * This library is free software; you can redistribute it and/or | |
| 6 | * modify it under the terms of the GNU Lesser General Public | |
| 7 | * License as published by the Free Software Foundation; either | |
| 8 | * version 2.1 of the License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This library is distributed in the hope that it will be useful, | |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * Lesser General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU Lesser General Public | |
| 16 | * License along with this library; if not, write to the Free Software | |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
| 18 | */ | |
| 19 | package org.jaudiotagger.audio.generic; | |
| 20 | ||
| 21 | import org.jaudiotagger.audio.AudioFile; | |
| 22 | import org.jaudiotagger.audio.exceptions.ModifyVetoException; | |
| 23 | ||
| 24 | import java.io.File; | |
| 25 | ||
| 26 | /** | |
| 27 | * Classes implementing this interface will be notified on audio file's | |
| 28 | * modifications.<br> | |
| 29 | * <p/> | |
| 30 | * <p>It will be notified on several occasions:<br> | |
| 31 | * <ul> | |
| 32 | * <li>An audio file is about to be modified | |
| 33 | * {@link #fileWillBeModified(AudioFile,boolean)}<br> | |
| 34 | * Here one can modify the tag data because of global settings.</li> | |
| 35 | * <li>The write process has just finished. But if a copy was created the | |
| 36 | * original has not been replaced yet. ({@link #fileModified(AudioFile,File)}).</li> | |
| 37 | * <li>The operation has been finished. {@link #fileOperationFinished(File)}</li> | |
| 38 | * </ul> | |
| 39 | * | |
| 40 | * @author Christian Laireiter <liree@web.de> | |
| 41 | */ | |
| 42 | public interface AudioFileModificationListener | |
| 43 | { | |
| 44 | ||
| 45 | /** | |
| 46 | * Notifies that <code>original</code> has been processed.<br> | |
| 47 | * Because the audiolibrary allows format implementors to either change the | |
| 48 | * original file or create a copy, it is possible that the real result is | |
| 49 | * located in the original and <code>temporary</code> is of zero size | |
| 50 | * <b>or</b> the original will be deleted and replaced by temporary.<br> | |
| 51 | * | |
| 52 | * @param original The original file on which the operation was started. | |
| 53 | * @param temporary The modified copy. (It may be of zero size if the original was | |
| 54 | * modified) | |
| 55 | * @throws ModifyVetoException If the Results doesn't fit the expectations of the listener, | |
| 56 | * it can prevent the replacement of the original by temporary.<br> | |
| 57 | * If the original is already modified, this exception results | |
| 58 | * in nothing. | |
| 59 | */ | |
| 60 | public void fileModified(AudioFile original, File temporary) throws ModifyVetoException; | |
| 61 | ||
| 62 | /** | |
| 63 | * Informs the listener that the process has been finished.<br> | |
| 64 | * The given file is either the original file or the modified copy.<br> | |
| 65 | * | |
| 66 | * @param result The remaining file. It's not of {@link AudioFile} since it may | |
| 67 | * be possible that a new file was created. In that case the | |
| 68 | * audiolibs would need to parse the file again, which leads to | |
| 69 | * long and unnecessary operation time, if the tag data is not | |
| 70 | * needed any more. | |
| 71 | */ | |
| 72 | public void fileOperationFinished(File result); | |
| 73 | ||
| 74 | /** | |
| 75 | * Notifies that the <code>file</code> is about to be modified. | |
| 76 | * | |
| 77 | * @param file The file that will be modified. | |
| 78 | * @param delete <code>true</code> if the deletion of tag data will be | |
| 79 | * performed. | |
| 80 | * @throws ModifyVetoException Thrown if the listener wants to prevent the process. | |
| 81 | */ | |
| 82 | public void fileWillBeModified(AudioFile file, boolean delete) throws ModifyVetoException; | |
| 83 | ||
| 84 | /** | |
| 85 | * This method notifies about a veto exception that has been thrown by | |
| 86 | * another listener.<br> | |
| 87 | * | |
| 88 | * @param cause The instance which caused the veto. | |
| 89 | * @param original The original file, that was about to be modified. | |
| 90 | * @param veto The thrown exception. | |
| 91 | */ | |
| 92 | public void vetoThrown(AudioFileModificationListener cause, AudioFile original, ModifyVetoException veto); | |
| 93 | ||
| 94 | } |