FileDocCategorySizeDatePackage
FrameBodyTIPL.javaAPI DocJaudiotagger 2.0.47963Mon Sep 26 13:47:50 BST 2011org.jaudiotagger.tag.id3.framebody

FrameBodyTIPL

public class FrameBodyTIPL extends AbstractID3v2FrameBody implements ID3v24FrameBody
The 'Involved people list' is intended as a mapping between functions like producer and names. Every odd field is a function and every even is an name or a comma delimited list of names.

Fields Summary
public static final String
ENGINEER
public static final String
MIXER
public static final String
DJMIXER
public static final String
PRODUCER
public static final String
ARRANGER
Constructors Summary
public FrameBodyTIPL()
Creates a new FrameBodyTIPL datatype.


              
     
    
        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, TextEncoding.ISO_8859_1);
    
public FrameBodyTIPL(byte textEncoding, String text)
Creates a new FrameBodyTIPL data type.

param
textEncoding
param
text

        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, textEncoding);
        setText(text);
    
public FrameBodyTIPL(ByteBuffer byteBuffer, int frameSize)
Creates a new FrameBodyTIPL data type.

param
byteBuffer
param
frameSize
throws
InvalidTagException

        super(byteBuffer, frameSize);
    
public FrameBodyTIPL(FrameBodyIPLS body)
Convert from V3 to V4 Frame

param
body

        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, body.getTextEncoding());
        setObjectValue(DataTypes.OBJ_TEXT, body.getPairing());
    
Methods Summary
public voidaddPair(java.lang.String text)
Parse text as a null separated pairing of name and function

param
text

        StringTokenizer stz = new StringTokenizer(text, "\0");
        if (stz.countTokens()==2)
        {
            addPair(stz.nextToken(),stz.nextToken());
        }
    
public voidaddPair(java.lang.String function, java.lang.String name)
Add pair

param
function
param
name

        PairedTextEncodedStringNullTerminated.ValuePairs value = ((PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT)).getValue();
        value.add(function, name);

    
public java.lang.StringgetIdentifier()
The ID3v2 frame identifier

return
the ID3v2 frame identifier for this frame type

        return ID3v24Frames.FRAME_ID_INVOLVED_PEOPLE;
    
public java.lang.StringgetKeyAtIndex(int index)
Get key at index

param
index
return
value at index

        PairedTextEncodedStringNullTerminated text = (PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT);
        return (String) text.getValue().getMapping().get(index).getKey();
    
public intgetNumberOfPairs()

return
number of text pairs

        PairedTextEncodedStringNullTerminated text = (PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT);
        return text.getValue().getNumberOfPairs();
    
public PairedTextEncodedStringNullTerminated.ValuePairsgetPairing()

        return (PairedTextEncodedStringNullTerminated.ValuePairs) getObject(DataTypes.OBJ_TEXT).getValue();
    
public java.lang.StringgetText()

        PairedTextEncodedStringNullTerminated text = (PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT);
        StringBuilder sb = new StringBuilder();
        int count = 1;
        for (Pair entry : text.getValue().getMapping())
        {
            sb.append(entry.getKey() + '\0" + entry.getValue());
            if (count != getNumberOfPairs())
            {
                sb.append('\0");
            }
            count++;
        }
        return sb.toString();
    
public java.lang.StringgetUserFriendlyValue()

        return getText();
    
public java.lang.StringgetValueAtIndex(int index)
Get value at index

param
index
return
value at index

        PairedTextEncodedStringNullTerminated text = (PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT);
        return (String) text.getValue().getMapping().get(index).getValue();
    
public voidresetPairs()
Remove all Pairs

        PairedTextEncodedStringNullTerminated.ValuePairs value = ((PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT)).getValue();
        value.getMapping().clear();
    
public voidsetText(java.lang.String text)
Set the text, decoded as pairs of involvee - involvement

param
text

        PairedTextEncodedStringNullTerminated.ValuePairs value = new PairedTextEncodedStringNullTerminated.ValuePairs();
        StringTokenizer stz = new StringTokenizer(text, "\0");

        while (stz.hasMoreTokens())
        {
            String key =stz.nextToken();
            if(stz.hasMoreTokens())
            {
                value.add(key, stz.nextToken());
            }
            
        }
        setObjectValue(DataTypes.OBJ_TEXT, value);
    
protected voidsetupObjectList()
Consists of a text encoding , and then a series of null terminated Strings, there should be an even number of Strings as they are paired as involvement/involvee

        objectList.add(new NumberHashMap(DataTypes.OBJ_TEXT_ENCODING, this, TextEncoding.TEXT_ENCODING_FIELD_SIZE));
        objectList.add(new PairedTextEncodedStringNullTerminated(DataTypes.OBJ_TEXT, this));
    
public voidwrite(java.io.ByteArrayOutputStream tagBuffer)
Because have a text encoding we need to check the data values do not contain characters that cannot be encoded in current encoding before we write data. If they do change the encoding.

        if (!((PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT)).canBeEncoded())
        {
            this.setTextEncoding(TextEncoding.UTF_16);
        }
        super.write(tagBuffer);