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


Java Utils.getString方法代码示例

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


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

示例1: Mp4MeanBox

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

    //Double check
    if (!header.getId().equals(IDENTIFIER))
    {
        throw new RuntimeException("Unable to process data box because identifier is:" + header.getId());
    }

    //Make slice so operations here don't effect position of main buffer
    this.dataBuffer = dataBuffer.slice();

    //issuer
    this.issuer = Utils.getString(this.dataBuffer, PRE_DATA_LENGTH, header.getDataLength() - PRE_DATA_LENGTH, header.getEncoding());

}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:22,代码来源:Mp4MeanBox.java

示例2: Mp4NameBox

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

    //Double check
    if (!header.getId().equals(IDENTIFIER))
    {
        throw new RuntimeException("Unable to process name box because identifier is:" + header.getId());
    }

    //Make slice so operations here don't effect position of main buffer
    this.dataBuffer = dataBuffer.slice();

    //issuer
    this.name = Utils.getString(this.dataBuffer, PRE_DATA_LENGTH, header.getDataLength() - PRE_DATA_LENGTH, header.getEncoding());
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:21,代码来源:Mp4NameBox.java

示例3: readChunk

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Reads a chunk and extracts information.
 *
 * @return <code>false</code> if the chunk is structurally
 * invalid, otherwise <code>true</code>
 */
public boolean readChunk() throws IOException
{
    final int numComments = Utils.u(chunkData.getShort());

    //For each comment
    for (int i = 0; i < numComments; i++)
    {
        final long timestamp  = Utils.u(chunkData.getInt());
        final Date jTimestamp = AiffUtil.timestampToDate(timestamp);
        final int marker      = Utils.u(chunkData.getShort());
        final int count       = Utils.u(chunkData.getShort());
        // Append a timestamp to the comment
        final String text = Utils.getString(chunkData, 0, count, StandardCharsets.ISO_8859_1) + " " + AiffUtil.formatDate(jTimestamp);
        if (count % 2 != 0) {
            // if count is odd, text is padded with an extra byte that we need to consume
            chunkData.get();
        }
        aiffHeader.addComment(text);
    }
    return true;
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:28,代码来源:CommentsChunk.java

示例4: readByteArray

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * @param arr
 * @param offset
 * @throws NullPointerException
 * @throws IndexOutOfBoundsException
 */
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException {
    if (arr == null) {
        throw new NullPointerException("Byte array is null");
    }

    if ((offset < 0) || (offset >= arr.length)) {
        throw new IndexOutOfBoundsException("Offset to byte array is out of bounds: offset = " + offset + ", array.length = " + arr.length);
    }

    //offset += ();
    text = Utils.getString(arr, offset, arr.length - offset - 4, "ISO-8859-1");

    //text = text.substring(0, text.length() - 5);
    timeStamp = 0;

    for (int i = arr.length - 4; i < arr.length; i++) {
        timeStamp <<= 8;
        timeStamp += arr[i];
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:27,代码来源:ID3v2LyricLine.java

示例5: Mp4MeanBox

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

    //Double check
    if (!header.getId().equals(IDENTIFIER)) {
        throw new RuntimeException("Unable to process data box because identifier is:" + header.getId());
    }

    //Make slice so operations here don't effect position of main buffer
    this.dataBuffer = dataBuffer.slice();

    //issuer
    this.issuer = Utils.getString(this.dataBuffer, PRE_DATA_LENGTH, header.getDataLength() - PRE_DATA_LENGTH, header.getEncoding());

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

示例6: 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

示例7: parseLameFrame

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Parse frame
 *
 * @param bb
 * @return frame or null if not exists
 */
public static LameFrame parseLameFrame(ByteBuffer bb)
{
    ByteBuffer lameHeader = bb.slice();
    String id = Utils.getString(lameHeader, 0, LAME_ID_SIZE, StandardCharsets.ISO_8859_1);
    lameHeader.rewind();
    if (id.equals(LAME_ID))
    {
        LameFrame lameFrame = new LameFrame(lameHeader);
        return lameFrame;
    }
    return null;
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:19,代码来源:LameFrame.java

示例8: Mp4NameBox

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

    //Double check
    if (!header.getId().equals(IDENTIFIER)) {
        throw new RuntimeException("Unable to process name box because identifier is:" + header.getId());
    }

    //Make slice so operations here don't effect position of main buffer
    this.dataBuffer = dataBuffer.slice();

    //issuer
    this.name = Utils.getString(this.dataBuffer, PRE_DATA_LENGTH, header.getDataLength() - PRE_DATA_LENGTH, header.getEncoding());
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:19,代码来源:Mp4NameBox.java

示例9: getImageUrl

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * @return the image url if there is otherwise return an empty String
 */
public String getImageUrl() {
    if (isImageUrl()) {
        return Utils.getString(((byte[]) getObjectValue(DataTypes.OBJ_PICTURE_DATA)), 0, ((byte[]) getObjectValue(DataTypes.OBJ_PICTURE_DATA)).length, TextEncoding.CHARSET_ISO_8859_1);
    } else {
        return "";
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:11,代码来源:FrameBodyPIC.java

示例10: decodeHeader

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
public void decodeHeader(byte[] b) {
    int packetType = b[FIELD_PACKET_TYPE_POS];
    logger.fine("packetType" + packetType);
    String vorbis = Utils.getString(b, VorbisHeader.FIELD_CAPTURE_PATTERN_POS, VorbisHeader.FIELD_CAPTURE_PATTERN_LENGTH, "ISO-8859-1");

    if (packetType == VorbisPacketType.IDENTIFICATION_HEADER.getType() && vorbis.equals(CAPTURE_PATTERN)) {
        this.vorbisVersion = b[7] + (b[8] << 8) + (b[9] << 16) + (b[10] << 24);
        logger.fine("vorbisVersion" + vorbisVersion);
        this.audioChannels = u(b[FIELD_AUDIO_CHANNELS_POS]);
        logger.fine("audioChannels" + audioChannels);
        this.audioSampleRate = u(b[12]) + (u(b[13]) << 8) + (u(b[14]) << 16) + (u(b[15]) << 24);
        logger.fine("audioSampleRate" + audioSampleRate);
        logger.fine("audioSampleRate" + b[12] + " " + b[13] + " " + b[14]);

        //TODO is this right spec says signed
        this.bitrateMinimal = u(b[16]) + (u(b[17]) << 8) + (u(b[18]) << 16) + (u(b[19]) << 24);
        this.bitrateNominal = u(b[20]) + (u(b[21]) << 8) + (u(b[22]) << 16) + (u(b[23]) << 24);
        this.bitrateMaximal = u(b[24]) + (u(b[25]) << 8) + (u(b[26]) << 16) + (u(b[27]) << 24);
        //byte blockSize0 = (byte) ( b[28] & 240 );
        //byte blockSize1 = (byte) ( b[28] & 15 );

        int framingFlag = b[FIELD_FRAMING_FLAG_POS];
        logger.fine("framingFlag" + framingFlag);
        if (framingFlag != 0) {
            isValid = true;
        }

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

示例11: decodeHeader

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
public void decodeHeader(byte[] b) {
    int packetType = b[FIELD_PACKET_TYPE_POS];
    logger.fine("packetType" + packetType);
    String vorbis = Utils.getString(b, FIELD_CAPTURE_PATTERN_POS, FIELD_CAPTURE_PATTERN_LENGTH, "ISO-8859-1");
    if (packetType == VorbisPacketType.SETUP_HEADER.getType() && vorbis.equals(CAPTURE_PATTERN)) {
        isValid = true;
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:9,代码来源:VorbisSetupHeader.java

示例12: parseLameFrame

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Parse frame
 *
 * @param bb
 * @return frame or null if not exists
 */
public static LameFrame parseLameFrame(ByteBuffer bb) {
    ByteBuffer lameHeader = bb.slice();
    String id = Utils.getString(lameHeader, 0, LAME_ID_SIZE, TextEncoding.CHARSET_ISO_8859_1);
    lameHeader.rewind();
    if (id.equals(LAME_ID)) {
        LameFrame lameFrame = new LameFrame(lameHeader);
        return lameFrame;
    }
    return null;
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:17,代码来源:LameFrame.java

示例13: getImageUrl

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * @return the image url if there is otherwise return an empty String
 */
public String getImageUrl() {
    if (isImageUrl()) {
        return Utils.getString(getImageData(), 0, getImageData().length, TextEncoding.CHARSET_ISO_8859_1);
    } else {
        return "";
    }
}
 
开发者ID:openaudible,项目名称:openaudible,代码行数:11,代码来源:MetadataBlockDataPicture.java

示例14: readChunks

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Read Info chunk
 * @param chunkData
 */
public  boolean readChunks(ByteBuffer chunkData)
{
    while(chunkData.remaining()>= IffHeaderChunk.TYPE_LENGTH)
    {
        String id       = Utils.readFourBytesAsChars(chunkData);
        //Padding
        if(id.trim().isEmpty())
        {
            return true;
        }
        int    size     = chunkData.getInt();

        if(
                (!Character.isAlphabetic(id.charAt(0)))||
                (!Character.isAlphabetic(id.charAt(1)))||
                (!Character.isAlphabetic(id.charAt(2)))||
                (!Character.isAlphabetic(id.charAt(3)))
           )
        {
            logger.severe(loggingName + "LISTINFO appears corrupt, ignoring:"+id+":"+size);
            return false;
        }

        String value =null;
        try
        {
            value = Utils.getString(chunkData, 0, size, StandardCharsets.UTF_8);
        }
        catch(BufferUnderflowException bue)
        {
            logger.log(Level.SEVERE, loggingName + "LISTINFO appears corrupt, ignoring:"+bue.getMessage(), bue);
            return false;
        }

        logger.config(loggingName + "Result:" + id + ":" + size + ":" + value + ":");
        WavInfoIdentifier wii = WavInfoIdentifier.getByCode(id);
        if(wii!=null && wii.getFieldKey()!=null)
        {
            try
            {
                wavInfoTag.setField(wii.getFieldKey(), value);
            }
            catch(FieldDataInvalidException fdie)
            {
                logger.log(Level.SEVERE, loggingName + fdie.getMessage(), fdie);
            }
        }
        //Add unless just padding
        else if(id!=null && !id.trim().isEmpty())
        {
            wavInfoTag.addUnRecognizedField(id, value);
        }

        //Each tuple aligned on even byte boundary
        if (Utils.isOddLength(size) && chunkData.hasRemaining())
        {
            chunkData.get();
        }
    }
    return true;
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:66,代码来源:WavInfoChunk.java

示例15: LameFrame

import org.jaudiotagger.audio.generic.Utils; //导入方法依赖的package包/类
/**
 * Initilise a Lame Mpeg Frame
 * @param lameHeader
 */
private LameFrame(ByteBuffer lameHeader)
{
    encoder = Utils.getString(lameHeader, 0, ENCODER_SIZE, StandardCharsets.ISO_8859_1);
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:9,代码来源:LameFrame.java


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