• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java CannotWriteException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jaudiotagger.audio.exceptions.CannotWriteException的典型用法代码示例。如果您正苦于以下问题:Java CannotWriteException类的具体用法?Java CannotWriteException怎么用?Java CannotWriteException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CannotWriteException类属于org.jaudiotagger.audio.exceptions包,在下文中一共展示了CannotWriteException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: delete

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Delete given {@link Tag} from file.
 *
 * @param tag  tag, must be instance of {@link AiffTag}
 * @param file
 * @throws java.io.IOException
 * @throws org.jaudiotagger.audio.exceptions.CannotWriteException
 */
public void delete(final Tag tag, File file) throws CannotWriteException {
    try {
        FileChannel fc = new FileOutputStream(file.getAbsolutePath(), false).getChannel();
        logger.severe(file.getAbsolutePath() + " Deleting tag from file");
        final AiffTag existingTag = getExistingMetadata(file);

        if (existingTag.isExistingId3Tag() && existingTag.getID3Tag().getStartLocationInFile() != null) {
            ChunkHeader chunkHeader = seekToStartOfMetadata(fc, existingTag, file.getAbsolutePath());
            if (isAtEndOfFileAllowingForPaddingByte(existingTag, fc)) {
                logger.severe(file.getAbsolutePath() + " Setting new length to:" + (existingTag.getStartLocationInFileOfId3Chunk()));
                fc.truncate(existingTag.getStartLocationInFileOfId3Chunk());
            } else {
                logger.severe(file.getAbsolutePath() + " Deleting tag chunk");
                deleteTagChunk(fc, existingTag, chunkHeader, file.getAbsolutePath());
            }
            rewriteRiffHeaderSize(fc);
        }
        logger.severe(file.getAbsolutePath() + " Deleted tag from file");
    } catch (IOException ioe) {
        throw new CannotWriteException(file.getAbsolutePath() + ":" + ioe.getMessage());
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:31,代码来源:AiffTagWriter.java


示例2: writeInfoChunk

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Write Info chunk to current location which is last chunk of file
 *
 * @param fc
 * @param existingInfoTag
 * @param newTagBuffer
 * @throws CannotWriteException
 * @throws IOException
 */
private void writeInfoChunk(FileChannel fc, final WavInfoTag existingInfoTag, ByteBuffer newTagBuffer)
        throws CannotWriteException, IOException {
    long newInfoTagSize = newTagBuffer.limit();
    //We have enough existing space in chunk so just keep existing chunk size
    if (existingInfoTag.getSizeOfTag() >= newInfoTagSize) {
        writeInfoDataToFile(fc, newTagBuffer, existingInfoTag.getSizeOfTag());
        //To ensure old data from previous tag are erased
        if (existingInfoTag.getSizeOfTag() > newInfoTagSize) {
            writePaddingToFile(fc, (int) (existingInfoTag.getSizeOfTag() - newInfoTagSize));
        }
    }
    //New tag is larger so set chunk size to accommodate it
    else {
        writeInfoDataToFile(fc, newTagBuffer, newInfoTagSize);
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:26,代码来源:WavTagWriter.java


示例3: saveActiveExisting

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Save Active chunk and existing chunks even if not the active chunk
 *
 * @param wavTag
 * @param fc
 * @param existingTag
 * @throws CannotWriteException
 * @throws IOException
 */
private void saveActiveExisting(WavTag wavTag, FileChannel fc, final WavTag existingTag)
        throws CannotWriteException, IOException {
    if (wavTag.getActiveTag() instanceof WavInfoTag) {
        if (existingTag.isExistingId3Tag()) {
            saveBoth(wavTag, fc, existingTag);
        } else {
            saveActive(wavTag, fc, existingTag);
        }
    } else {
        if (existingTag.isExistingInfoTag()) {
            saveBoth(wavTag, fc, existingTag);
        } else {
            saveActive(wavTag, fc, existingTag);
        }
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:26,代码来源:WavTagWriter.java


示例4: delete

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
public void delete(RandomAccessFile raf, RandomAccessFile tempRaf) throws IOException, CannotReadException, CannotWriteException
{
    try
    {
        reader.read(raf);
    }
    catch (CannotReadException e)
    {
        write(VorbisCommentTag.createNewTag(), raf, tempRaf);
        return;
    }

    VorbisCommentTag emptyTag = VorbisCommentTag.createNewTag();

    //Go back to start of file
    raf.seek(0);
    write(emptyTag, raf, tempRaf);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:19,代码来源:OggVorbisTagWriter.java


示例5: replaceSecondPageAndRenumberPageSeqs

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Previously comment and/or setup header was on a number of pages now can just replace this page fitting all
 * on 2nd page, and renumber subsequent sequence pages
 *
 * @param originalHeaderSizes
 * @param newCommentLength
 * @param newSecondPageLength
 * @param secondPageHeader
 * @param newComment
 * @param raf
 * @param rafTemp
 * @throws IOException
 * @throws org.jaudiotagger.audio.exceptions.CannotReadException
 * @throws org.jaudiotagger.audio.exceptions.CannotWriteException
 */
private void replaceSecondPageAndRenumberPageSeqs(OggVorbisTagReader.OggVorbisHeaderSizes originalHeaderSizes, int newCommentLength, int newSecondPageLength, OggPageHeader secondPageHeader, ByteBuffer newComment, RandomAccessFile raf, RandomAccessFile rafTemp) throws IOException, CannotReadException, CannotWriteException
{
    logger.fine("WriteOgg Type 2");
    ByteBuffer secondPageBuffer = startCreateBasicSecondPage(originalHeaderSizes, newCommentLength, newSecondPageLength, secondPageHeader, newComment);

    //Add setup header and packets
    int pageSequence = secondPageHeader.getPageSequence();
    byte[] setupHeaderData = reader.convertToVorbisSetupHeaderPacketAndAdditionalPackets(originalHeaderSizes.getSetupHeaderStartPosition(), raf);
    logger.finest(setupHeaderData.length + ":" + secondPageBuffer.position() + ":" + secondPageBuffer.capacity());
    secondPageBuffer.put(setupHeaderData);

    calculateChecksumOverPage(secondPageBuffer);
    rafTemp.getChannel().write(secondPageBuffer);
    writeRemainingPages(pageSequence, raf, rafTemp);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:31,代码来源:OggVorbisTagWriter.java


示例6: writeNewMetadataLargerButCanUseFreeAtom

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * We can fit the metadata in under the meta item just by using some of the padding available in the {@code free}
 * atom under the {@code meta} atom need to take of the side of free header otherwise might end up with
 * solution where can fit in data, but can't fit in free atom header.
 *
 * @param fileReadChannel
 * @param fileWriteChannel
 * @param neroTagsHeader
 * @param sizeOfExistingMetaLevelFreeAtom
 * @param newIlstData
 * @param additionalSpaceRequiredForMetadata
 * @throws IOException
 * @throws CannotWriteException
 */
private void writeNewMetadataLargerButCanUseFreeAtom(FileChannel fileReadChannel, FileChannel fileWriteChannel, Mp4BoxHeader ilstHeader, Mp4BoxHeader neroTagsHeader, int sizeOfExistingMetaLevelFreeAtom, ByteBuffer newIlstData, int additionalSpaceRequiredForMetadata) throws IOException, CannotWriteException
{
    int newFreeSize = sizeOfExistingMetaLevelFreeAtom - (additionalSpaceRequiredForMetadata);
    logger.config("Writing:Option 5;Larger Size can use meta free atom need extra:" + newFreeSize + "bytes");

    writeDataUptoIncludingIlst(fileReadChannel, fileWriteChannel, ilstHeader, newIlstData);

    //Create an amended smaller freeBaos atom and write it to file
    Mp4FreeBox newFreeBox = new Mp4FreeBox(newFreeSize - Mp4BoxHeader.HEADER_LENGTH);
    fileWriteChannel.write(newFreeBox.getHeader().getHeaderData());
    fileWriteChannel.write(newFreeBox.getData());

    //Skip over the read channel old free atom
    fileReadChannel.position(fileReadChannel.position() + sizeOfExistingMetaLevelFreeAtom);
    writeDataAfterIlst(fileReadChannel, fileWriteChannel, neroTagsHeader);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:31,代码来源:Mp4TagWriter.java


示例7: writeDataInChunks

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Write the remainder of data in read channel to write channel data in {@link TagOptionSingleton#getWriteChunkSize()}
 * chunks, needed if writing large amounts of data.
 *
 * @param fileReadChannel
 * @param fileWriteChannel
 * @throws IOException
 * @throws CannotWriteException
 */
private void writeDataInChunks(FileChannel fileReadChannel, FileChannel fileWriteChannel) throws IOException, CannotWriteException
{
    long amountToBeWritten = fileReadChannel.size() - fileReadChannel.position();
    long written = 0;
    long chunksize = TagOptionSingleton.getInstance().getWriteChunkSize();
    long count = amountToBeWritten / chunksize;

    long mod = amountToBeWritten % chunksize;
    for (int i = 0; i < count; i++)
    {
        written += fileWriteChannel.transferFrom(fileReadChannel, fileWriteChannel.position(), chunksize);
        fileWriteChannel.position(fileWriteChannel.position() + chunksize);
    }

    if(mod > 0)
    {
        written += fileWriteChannel.transferFrom(fileReadChannel, fileWriteChannel.position(), mod);
        if (written != amountToBeWritten)
        {
            throw new CannotWriteException("Was meant to write " + amountToBeWritten + " bytes but only written " + written + " bytes");
        }
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:33,代码来源:Mp4TagWriter.java


示例8: delete

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的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);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:27,代码来源:AudioFileWriter2.java


示例9: write

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的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);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:27,代码来源:AudioFileWriter2.java


示例10: precheckWrite

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的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()));
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:37,代码来源:AudioFileWriter.java


示例11: deleteTag

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Delete Metadata tag
 *
 * @param tag
 * @param file
 * @throws CannotWriteException
 * @throws IOException
 */
@Override
protected void deleteTag(Tag tag, File file) throws CannotWriteException {
    try {
        FileChannel fc = new FileOutputStream(file.getAbsolutePath(), false).getChannel();
        DsdChunk dsd = DsdChunk.readChunk(Utils.readFileDataIntoBufferLE(fc, DsdChunk.DSD_HEADER_LENGTH));
        if (dsd != null) {
            if (dsd.getMetadataOffset() > 0) {
                fc.position(dsd.getMetadataOffset());
                ID3Chunk id3Chunk = ID3Chunk.readChunk(Utils.readFileDataIntoBufferLE(fc, (int) (fc.size() - fc.position())));
                if (id3Chunk != null) {
                    fc.truncate(dsd.getMetadataOffset());
                    //set correct value for fileLength and zero offset
                    dsd.setMetadataOffset(0);
                    dsd.setFileLength(fc.size());
                    fc.position(0);
                    fc.write(dsd.write());
                }
            } else {
                //Do Nothing;
            }
        }
    } catch (IOException ioe) {
        throw new CannotWriteException(file.getAbsolutePath() + ":" + ioe.getMessage());
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:34,代码来源:DsfFileWriter.java


示例12: writeFile

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 *
 * Write the tag contained in the audioFile in the actual file on the disk.
 * 
 *
 * @param f The AudioFile to be written
 * @param targetPath a file path, without an extension, which provides a "save as". If null, then normal "save" function
 * @throws NoWritePermissionsException if the file could not be written to due to file permissions
 * @throws CannotWriteException If the file could not be written/accessed, the extension
 *                              wasn't recognized, or other IO error occurred.
 */
public void writeFile(AudioFile f, String targetPath) throws CannotWriteException
{
	String ext = f.getExt();

    if (targetPath != null && !targetPath.isEmpty())
    {
        final File destination = new File(targetPath + "." + ext);
            try
            {
                Utils.copyThrowsOnException(f.getFile(), destination);
                f.setFile(destination);
            } catch (IOException e) {
                throw new CannotWriteException("Error While Copying" + e.getMessage());
            }
    }

    AudioFileWriter afw = writers.get(ext);
    if (afw == null)
    {
        throw new CannotWriteException(ErrorMessage.NO_WRITER_FOR_THIS_FORMAT.getMsg(ext));
    }

    afw.write(f);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:36,代码来源:AudioFileIO.java


示例13: insertLyrics

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Insert Lyrics
 *
 * @param path
 * @param lyrics
 * @return
 */
public static boolean insertLyrics(String path, String lyrics) {
    File f = new File(path);
    if (f.exists()) {
        try {
            AudioFile audioFile = AudioFileIO.read(f);
            if (audioFile == null) {
                return false;
            }
            TagOptionSingleton.getInstance().setAndroid(true);
            Tag tag = audioFile.getTag();
            if (tag == null) {
                return false;
            }
            tag.deleteField(FieldKey.LYRICS);
            tag.setField(FieldKey.LYRICS, lyrics);
            audioFile.setTag(tag);
            AudioFileIO.write(audioFile);
            return true;
        } catch (CannotReadException | CannotWriteException | InvalidAudioFrameException | TagException | IOException | ReadOnlyFileException e) {
            e.printStackTrace();
        }
    }
    return false;
}
 
开发者ID:RajneeshSingh007,项目名称:MusicX-music-player,代码行数:32,代码来源:LyricsHelper.java


示例14: writeDataInChunks

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * #385 Write data in chunks, needed if writing large amounts of data
 *
 * @param fileReadChannel
 * @param fileWriteChannel
 * @throws IOException
 * @throws CannotWriteException
 */
private void writeDataInChunks(FileChannel fileReadChannel, FileChannel fileWriteChannel)
        throws IOException, CannotWriteException {
    long amountToBeWritten = fileReadChannel.size() - fileReadChannel.position();
    long written = 0;
    long chunksize = TagOptionSingleton.getInstance().getWriteChunkSize();
    long count = amountToBeWritten / chunksize;

    long mod = amountToBeWritten % chunksize;
    for (int i = 0; i < count; i++) {
        written += fileWriteChannel.transferFrom(fileReadChannel, fileWriteChannel.position(), chunksize);
        fileWriteChannel.position(fileWriteChannel.position() + chunksize);
    }
    written += fileWriteChannel.transferFrom(fileReadChannel, fileWriteChannel.position(), mod);
    if (written != amountToBeWritten) {
        throw new CannotWriteException("Was meant to write " + amountToBeWritten + " bytes but only written " + written + " bytes");
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:26,代码来源:Mp4TagWriter.java


示例15: persistThroughFile

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
/**
 * Writes changes in tags directly into file and closes activity.
 * Call this if you're absolutely sure everything is right with file and tag.
 */
private void persistThroughFile() {
    try {
        AudioFileIO.write(mAudioFile);
        Toast.makeText(this, R.string.file_written_successfully, Toast.LENGTH_SHORT).show();

        // update media database
        File persisted = mAudioFile.getFile();
        MediaScannerConnection.scanFile(this, new String[]{persisted.getAbsolutePath()}, null, null);
    } catch (CannotWriteException e) {
        Log.e(LOG_TAG,
                String.format(getString(R.string.error_audio_file), mAudioFile.getFile().getPath()), e);
        Toast.makeText(this,
                String.format(getString(R.string.error_audio_file) + ", %s",
                        mAudioFile.getFile().getPath(),
                        e.getLocalizedMessage()),
                Toast.LENGTH_LONG).show();
    }
}
 
开发者ID:vanilla-music,项目名称:vanilla-music-tag-editor,代码行数:23,代码来源:PluginService.java


示例16: write

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
@Override
public void write(final AudioFile af, final Tag tag, final RandomAccessFile raf, final RandomAccessFile rafTemp) throws CannotWriteException, IOException {
    logger.info("Writing tag to file");

    WavSaveOptions wso = TagOptionSingleton.getInstance().getWavSaveOptions();
    final WavTag existingTag = getExistingMetadata(raf);

    try {
        final WavTag wavTag = (WavTag) tag;
        if (wso == WavSaveOptions.SAVE_BOTH) {
            saveBoth(wavTag, raf, existingTag);
        } else if (wso == WavSaveOptions.SAVE_ACTIVE) {
            saveActive(wavTag, raf, existingTag);
        } else if (wso == WavSaveOptions.SAVE_EXISTING_AND_ACTIVE) {
            saveActiveExisting(wavTag, raf, existingTag);
        }
        //Invalid Option, should never happen
        else {
            throw new RuntimeException("No setting for:WavSaveOptions");
        }
        rewriteRiffHeaderSize(raf);
    } finally {
        raf.close();
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:26,代码来源:WavTagWriter.java


示例17: writeInfoChunk

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
private void writeInfoChunk(RandomAccessFile raf, final WavInfoTag existingInfoTag, ByteBuffer newTagBuffer)
        throws CannotWriteException, IOException {
    long newInfoTagSize = newTagBuffer.limit();
    //We have enough existing space in chunk so just keep existing chunk size
    if (existingInfoTag.getSizeOfTag() >= newInfoTagSize) {
        writeInfoDataToFile(raf, newTagBuffer, existingInfoTag.getSizeOfTag());
        //To ensure old data from previous tag are erased
        if (existingInfoTag.getSizeOfTag() > newInfoTagSize) {
            writePaddingToFile(raf, (int) (existingInfoTag.getSizeOfTag() - newInfoTagSize));
        }
    }
    //New tag is larger so set chunk size to accommodate it
    else {
        writeInfoDataToFile(raf, newTagBuffer, newInfoTagSize);
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:17,代码来源:WavTagWriter.java


示例18: writeId3Chunk

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
private void writeId3Chunk(RandomAccessFile raf, final AbstractID3Tag existingTag, ByteBuffer newTagBuffer)
        throws CannotWriteException, IOException {
    long newId3TagSize = newTagBuffer.limit();
    //We have enough existing space in chunk so just keep existing chunk size
    if (existingTag.getSize() >= newId3TagSize) {
        writeID3DataToFile(raf, newTagBuffer, existingTag.getSize());
        //To ensure old data from previous tag are erased
        if (existingTag.getSize() > newId3TagSize) {
            writePaddingToFile(raf, (int) (existingTag.getSize() - newId3TagSize));
        }
    }
    //New tag is larger so set chunk size to accommodate it
    else {
        writeID3DataToFile(raf, newTagBuffer, newId3TagSize);
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:17,代码来源:WavTagWriter.java


示例19: saveActiveExisting

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
private void saveActiveExisting(WavTag wavTag, RandomAccessFile raf, final WavTag existingTag)
        throws CannotWriteException, IOException {
    if (wavTag.getActiveTag() instanceof WavInfoTag) {
        if (existingTag.isExistingId3Tag()) {
            saveBoth(wavTag, raf, existingTag);
        } else {
            saveActive(wavTag, raf, existingTag);
        }
    } else {
        if (existingTag.isExistingInfoTag()) {
            saveBoth(wavTag, raf, existingTag);
        } else {
            saveActive(wavTag, raf, existingTag);
        }
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:17,代码来源:WavTagWriter.java


示例20: writeDataInChunks

import org.jaudiotagger.audio.exceptions.CannotWriteException; //导入依赖的package包/类
private void writeDataInChunks(FileChannel fileReadChannel, FileChannel fileWriteChannel) throws IOException, CannotWriteException {
    long amountToBeWritten = fileReadChannel.size() - fileReadChannel.position();
    long written = 0;
    long chunksize = TagOptionSingleton.getInstance().getWriteChunkSize();
    long count = amountToBeWritten / chunksize;

    long mod = amountToBeWritten % chunksize;
    for (int i = 0; i < count; i++) {
        written += fileWriteChannel.transferFrom(fileReadChannel, fileWriteChannel.position(), chunksize);
        fileWriteChannel.position(fileWriteChannel.position() + chunksize);
    }
    written += fileWriteChannel.transferFrom(fileReadChannel, fileWriteChannel.position(), mod);
    if (written != amountToBeWritten) {
        throw new CannotWriteException("Was meant to write " + amountToBeWritten + " bytes but only written " + written + " bytes");
    }
}
 
开发者ID:Old-Geek,项目名称:Musique,代码行数:17,代码来源:Mp4TagWriter.java



注:本文中的org.jaudiotagger.audio.exceptions.CannotWriteException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Literal类代码示例发布时间:2022-05-21
下一篇:
Java Text类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap