FileDocCategorySizeDatePackage
FrameBodyIPLS.javaAPI DocJaudiotagger 2.0.47549Wed Mar 30 16:12:02 BST 2011org.jaudiotagger.tag.id3.framebody

FrameBodyIPLS

public class FrameBodyIPLS extends AbstractID3v2FrameBody implements ID3v23FrameBody
Involved People List ID3v22/v23 Only

Since there might be a lot of people contributing to an audio file in various ways, such as musicians and technicians, the 'Text information frames' are often insufficient to list everyone involved in a project. The 'Involved people list' is a frame containing the names of those involved, and how they were involved. The body simply contains a terminated string with the involvement directly followed by a terminated string with the involvee followed by a new involvement and so on. There may only be one "IPLS" frame in each tag.

Text encoding $xx People list strings

For more details, please refer to the ID3 specifications:

author
: Paul Taylor
author
: Eric Farng
version
$Id: FrameBodyIPLS.java 923 2010-10-16 21:59:49Z paultaylor $

Fields Summary
Constructors Summary
public FrameBodyIPLS()
Creates a new FrameBodyIPLS datatype.

        super();
        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, TextEncoding.ISO_8859_1);
    
public FrameBodyIPLS(ByteBuffer byteBuffer, int frameSize)

        super(byteBuffer, frameSize);
    
public FrameBodyIPLS(FrameBodyIPLS body)

        super(body);
    
public FrameBodyIPLS(byte textEncoding, String text)
Creates a new FrameBodyIPLS data type.

param
textEncoding
param
text

        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, textEncoding);
        setText(text);
    
public FrameBodyIPLS(FrameBodyTIPL body)
Convert from V4 to V3 Frame

param
body

        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, body.getTextEncoding());
        setText(body.getText());
    
Methods Summary
public voidaddPair(java.lang.String text)

        PairedTextEncodedStringNullTerminated.ValuePairs value = ((PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT)).getValue();
        StringTokenizer stz = new StringTokenizer(text, "\0");
        if (stz.hasMoreTokens())
        {
            value.add(stz.nextToken(),stz.nextToken());
        }
    
public java.lang.StringgetIdentifier()
The ID3v23 frame identifier

return
the ID3v23 frame identifier for this frame type

        return ID3v23Frames.FRAME_ID_V3_IPLS;
    
public java.lang.StringgetKeyAtIndex(int index)
Get key at index

param
index
return
value at index

        PairedTextEncodedStringNullTerminated text = (PairedTextEncodedStringNullTerminated) getObject(DataTypes.OBJ_TEXT);
        return 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 text.getValue().getMapping().get(index).getValue();
    
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);