当前位置: 首页>>代码示例>>Java>>正文


Java Utils.getIntBE方法代码示例

本文整理汇总了Java中org.jaudiotagger.audio.generic.Utils.getIntBE方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.getIntBE方法的具体用法?Java Utils.getIntBE怎么用?Java Utils.getIntBE使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jaudiotagger.audio.generic.Utils的用法示例。


在下文中一共展示了Utils.getIntBE方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Mp4StcoBox

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Construct box from data and adjust offets accordingly
 *
 * @param header             header info
 * @param originalDataBuffer data of box (doesnt include header data)
 * @param adjustment
 */
public Mp4StcoBox(Mp4BoxHeader header, ByteBuffer originalDataBuffer, int adjustment)
{
    this.header = header;

    //Make a slice of databuffer then we can work with relative or absolute methods safetly
    this.dataBuffer = originalDataBuffer.slice();

    //Skip the flags
    dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH);

    //No of offsets
    this.noOfOffSets = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + NO_OF_OFFSETS_LENGTH - 1));
    dataBuffer.position(dataBuffer.position() + NO_OF_OFFSETS_LENGTH);

    for (int i = 0; i < noOfOffSets; i++)
    {
        int offset = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + NO_OF_OFFSETS_LENGTH - 1));

        //Calculate new offset and update buffer
        offset = offset + adjustment;
        dataBuffer.put(Utils.getSizeBEInt32(offset));
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:31,代码来源:Mp4StcoBox.java

示例2: update

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Create header using headerdata, expected to find header at headerdata current position
 * <p/>
 * Note after processing adjusts position to immediately after header
 *
 * @param headerData
 */
public void update(ByteBuffer headerData) {
    //Read header data into byte array
    byte[] b = new byte[HEADER_LENGTH];
    headerData.get(b);
    //Keep reference to copy of RawData
    dataBuffer = ByteBuffer.wrap(b);

    //Calculate box size
    this.length = Utils.getIntBE(b, OFFSET_POS, OFFSET_LENGTH - 1);
    //Calculate box id
    this.id = Utils.getString(b, IDENTIFIER_POS, IDENTIFIER_LENGTH, "ISO-8859-1");

    logger.finest("Mp4BoxHeader id:" + id + ":length:" + length);
    if (id.equals("\0\0\0\0")) {
        throw new NullBoxIdException(ErrorMessage.MP4_UNABLE_TO_FIND_NEXT_ATOM_BECAUSE_IDENTIFIER_IS_INVALID.getMsg(id));
    }

    if (length < HEADER_LENGTH) {
        throw new InvalidBoxHeaderException(ErrorMessage.MP4_UNABLE_TO_FIND_NEXT_ATOM_BECAUSE_IDENTIFIER_IS_INVALID.getMsg(id, length));
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:29,代码来源:Mp4BoxHeader.java

示例3: Mp4StcoBox

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Construct box from data and show contents
 *
 * @param header header info
 * @param buffer data of box (doesnt include header data)
 */
public Mp4StcoBox(Mp4BoxHeader header, ByteBuffer buffer) {
    this.header = header;

    //Make a slice of databuffer then we can work with relative or absolute methods safetly
    dataBuffer = buffer.slice();

    //Skip the flags
    dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH);

    //No of offsets
    this.noOfOffSets = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + NO_OF_OFFSETS_LENGTH - 1));
    dataBuffer.position(dataBuffer.position() + NO_OF_OFFSETS_LENGTH);

    //First Offset, useful for sanity checks
    firstOffSet = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + OFFSET_LENGTH - 1));
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:23,代码来源:Mp4StcoBox.java

示例4: printTotalOffset

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
public void printTotalOffset()
{
    int offset = 0;
    dataBuffer.rewind();
    dataBuffer.position(VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH + NO_OF_OFFSETS_LENGTH);
    for (int i = 0; i < noOfOffSets - 1; i++)
    {
        offset += Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + OFFSET_LENGTH - 1));
        dataBuffer.position(dataBuffer.position() + OFFSET_LENGTH);
    }
    offset += Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + OFFSET_LENGTH - 1));
    System.out.println("Print Offset Total:" + offset);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:14,代码来源:Mp4StcoBox.java

示例5: printTotalOffset

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
public void printTotalOffset() {
    int offset = 0;
    dataBuffer.rewind();
    dataBuffer.position(VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH + NO_OF_OFFSETS_LENGTH);
    for (int i = 0; i < noOfOffSets - 1; i++) {
        offset += Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + OFFSET_LENGTH - 1));
        dataBuffer.position(dataBuffer.position() + OFFSET_LENGTH);
    }
    offset += Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + OFFSET_LENGTH - 1));
    System.out.println("Print Offset Total:" + offset);
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:12,代码来源:Mp4StcoBox.java

示例6: adjustOffsets

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
public void adjustOffsets(int adjustment) {
    //Skip the flags
    dataBuffer.rewind();
    dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH + NO_OF_OFFSETS_LENGTH);
    for (int i = 0; i < noOfOffSets; i++) {
        int offset = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + NO_OF_OFFSETS_LENGTH - 1));

        //Calculate new offset and update buffer
        offset = offset + adjustment;
        dataBuffer.put(Utils.getSizeBEInt32(offset));
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:13,代码来源:Mp4StcoBox.java

示例7: Mp4MvhdBox

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * @param header     header info
 * @param dataBuffer data of box (doesnt include header data)
 */
public Mp4MvhdBox(Mp4BoxHeader header, ByteBuffer dataBuffer) {
    this.header = header;
    byte version = dataBuffer.get(VERSION_FLAG_POS);

    if (version == LONG_FORMAT) {
        this.timeScale = Utils.getIntBE(dataBuffer, TIMESCALE_LONG_POS, (TIMESCALE_LONG_POS + TIMESCALE_LENGTH - 1));
        this.timeLength = Utils.getLongBE(dataBuffer, DURATION_LONG_POS, (DURATION_LONG_POS + DURATION_LONG_LENGTH - 1));
    } else {
        this.timeScale = Utils.getIntBE(dataBuffer, TIMESCALE_SHORT_POS, (TIMESCALE_SHORT_POS + TIMESCALE_LENGTH - 1));
        this.timeLength = Utils.getIntBE(dataBuffer, DURATION_SHORT_POS, (DURATION_SHORT_POS + DURATION_SHORT_LENGTH - 1));
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:17,代码来源:Mp4MvhdBox.java

示例8: Mp4MdhdBox

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * @param header     header info
 * @param dataBuffer data of box (doesnt include header data)
 */
public Mp4MdhdBox(Mp4BoxHeader header, ByteBuffer dataBuffer) {
    this.header = header;

    byte version = dataBuffer.get(VERSION_FLAG_POS);

    long timeLength;
    if (version == LONG_FORMAT) {
        this.samplingRate = Utils.getIntBE(dataBuffer, TIMESCALE_LONG_POS, (TIMESCALE_LONG_POS + TIMESCALE_LENGTH - 1));
        timeLength = Utils.getLongBE(dataBuffer, DURATION_LONG_POS, (DURATION_LONG_POS + DURATION_LONG_LENGTH - 1));
    } else {
        this.samplingRate = Utils.getIntBE(dataBuffer, TIMESCALE_SHORT_POS, (TIMESCALE_SHORT_POS + TIMESCALE_LENGTH - 1));
        timeLength = Utils.getIntBE(dataBuffer, DURATION_SHORT_POS, (DURATION_SHORT_POS + DURATION_SHORT_LENGTH - 1));
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:19,代码来源:Mp4MdhdBox.java

示例9: Mp4EsdsBox

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * DataBuffer must start from from the start of the body
 *
 * @param header     header info
 * @param dataBuffer data of box (doesnt include header data)
 */
public Mp4EsdsBox(Mp4BoxHeader header, ByteBuffer dataBuffer) {
    this.header = header;

    //Not currently used, as lengths can extend over more than one section i think
    int sectionThreeLength;
    int sectionFourLength;
    int sectionFiveLength;
    int sectionSixLength;

    //As explained earlier the length of this atom is not fixed so processing is a bit more difficult
    //Process Flags
    dataBuffer.position(dataBuffer.position() + VERSION_FLAG_LENGTH + OTHER_FLAG_LENGTH);

    //Process Section 3 if exists
    if (dataBuffer.get() == SECTION_THREE) {
        sectionThreeLength = processSectionHeader(dataBuffer);
        //Skip Other Section 3 data
        dataBuffer.position(dataBuffer.position() + ES_ID_LENGTH + STREAM_PRIORITY_LENGTH);
    }

    //Process Section 4 (to getFields type and bitrate)
    if (dataBuffer.get() == SECTION_FOUR) {
        sectionFourLength = processSectionHeader(dataBuffer);

        //kind (in iTunes)
        kind = kindMap.get((int) dataBuffer.get());

        //Skip Other Section 4 data
        dataBuffer.position(dataBuffer.position() + STREAM_TYPE_LENGTH + BUFFER_SIZE_LENGTH);

        //Bit rates
        this.maxBitrate = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + MAX_BITRATE_LENGTH - 1));
        dataBuffer.position(dataBuffer.position() + MAX_BITRATE_LENGTH);

        this.avgBitrate = Utils.getIntBE(dataBuffer, dataBuffer.position(), (dataBuffer.position() + AVERAGE_BITRATE_LENGTH - 1));
        dataBuffer.position(dataBuffer.position() + AVERAGE_BITRATE_LENGTH);


    }
    //Process Section 5,(to getFields no of channels and audioprofile(profile in itunes))
    if (dataBuffer.get() == SECTION_FIVE) {
        sectionFiveLength = processSectionHeader(dataBuffer);

        //Audio Profile
        audioProfile = audioProfileMap.get((dataBuffer.get() >> 3));

        //Channels
        byte channelByte = dataBuffer.get();
        numberOfChannels = (channelByte << 1) >> 4;
    }

    //Process Section 6, not needed ...


}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:62,代码来源:Mp4EsdsBox.java


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