本文整理汇总了Java中org.jaudiotagger.audio.AudioFile.getFile方法的典型用法代码示例。如果您正苦于以下问题:Java AudioFile.getFile方法的具体用法?Java AudioFile.getFile怎么用?Java AudioFile.getFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jaudiotagger.audio.AudioFile
的用法示例。
在下文中一共展示了AudioFile.getFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: delete
import org.jaudiotagger.audio.AudioFile; //导入方法依赖的package包/类
/**
* Delete the tag (if any) present in the given file
*
* @param af The file to process
*
* @throws CannotWriteException if anything went wrong
* @throws org.jaudiotagger.audio.exceptions.CannotReadException
*/
@Override
public void delete(AudioFile af) throws CannotReadException, CannotWriteException
{
File file = af.getFile();
if (TagOptionSingleton.getInstance().isCheckIsWritable() && !file.canWrite())
{
throw new CannotWriteException(ErrorMessage.GENERAL_DELETE_FAILED
.getMsg(file.getAbsolutePath()));
}
if (af.getFile().length() <= MINIMUM_FILESIZE)
{
throw new CannotWriteException(ErrorMessage.GENERAL_DELETE_FAILED_BECAUSE_FILE_IS_TOO_SMALL
.getMsg(file));
}
deleteTag(af.getTag(), file);
}
示例2: write
import org.jaudiotagger.audio.AudioFile; //导入方法依赖的package包/类
/**
* Replace with new tag
*
* @param af The file we want to process
* @throws CannotWriteException
*/
@Override
public void write(AudioFile af) throws CannotWriteException
{
File file = af.getFile();
if (TagOptionSingleton.getInstance().isCheckIsWritable() && !file.canWrite())
{
logger.severe(ErrorMessage.GENERAL_WRITE_FAILED.getMsg(af.getFile()
.getPath()));
throw new CannotWriteException(ErrorMessage.GENERAL_WRITE_FAILED_TO_OPEN_FILE_FOR_EDITING
.getMsg(file.getAbsolutePath()));
}
if (af.getFile().length() <= MINIMUM_FILESIZE)
{
throw new CannotWriteException(ErrorMessage.GENERAL_WRITE_FAILED_BECAUSE_FILE_IS_TOO_SMALL
.getMsg(file));
}
writeTag(af.getTag(), file);
}
示例3: precheckWrite
import org.jaudiotagger.audio.AudioFile; //导入方法依赖的package包/类
/**
* Prechecks before normal write
* <p/>
* <ul>
* <li>If the tag is actually empty, remove the tag</li>
* <li>if the file is not writable, throw exception
* <li>
* <li>If the file is too small to be a valid file, throw exception
* <li>
* </ul>
*
* @param af
* @throws CannotWriteException
*/
private void precheckWrite(AudioFile af) throws CannotWriteException {
// Preliminary checks
try {
if (af.getTag().isEmpty()) {
delete(af);
return;
}
} catch (CannotReadException re) {
throw new CannotWriteException(ErrorMessage.GENERAL_WRITE_FAILED.getMsg(af.getFile().getPath()));
}
File file = af.getFile();
if (TagOptionSingleton.getInstance().isCheckIsWritable() && !file.canWrite()) {
logger.severe(ErrorMessage.GENERAL_WRITE_FAILED.getMsg(af.getFile().getPath()));
throw new CannotWriteException(ErrorMessage.GENERAL_WRITE_FAILED_TO_OPEN_FILE_FOR_EDITING.getMsg(file.getAbsolutePath()));
}
if (af.getFile().length() <= MINIMUM_FILESIZE) {
logger.severe(ErrorMessage.GENERAL_WRITE_FAILED_BECAUSE_FILE_IS_TOO_SMALL.getMsg(file.getAbsolutePath()));
throw new CannotWriteException(ErrorMessage.GENERAL_WRITE_FAILED_BECAUSE_FILE_IS_TOO_SMALL.getMsg(file.getAbsolutePath()));
}
}