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

FrameBodyUSLT

public class FrameBodyUSLT extends AbstractID3v2FrameBody implements ID3v24FrameBody, ID3v23FrameBody
Unsychronised lyrics/text transcription frame.

This frame contains the lyrics of the song or a text transcription of other vocal activities. The head includes an encoding descriptor and a content descriptor. The body consists of the actual text. The 'Content descriptor' is a terminated string. If no descriptor is entered, 'Content descriptor' is $00 (00) only. Newline characters are allowed in the text. There may be more than one 'Unsynchronised lyrics/text transcription' frame in each tag, but only one with the same language and content descriptor.

<Header for 'Unsynchronised lyrics/text transcription', ID: "USLT">
Text encoding $xx
Language $xx xx xx
Content descriptor<text string according to encoding> $00 (00)
Lyrics/text <full text string according to encoding>

You can retrieve the first value without the null terminator using {@link #getFirstTextValue}

For more details, please refer to the ID3 specifications:

author
: Paul Taylor
author
: Eric Farng
version
$Id: FrameBodyUSLT.java 908 2010-08-04 18:43:30Z paultaylor $

Fields Summary
Constructors Summary
public FrameBodyUSLT()
Creates a new FrameBodyUSLT dataType.

        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, TextEncoding.ISO_8859_1);
        setObjectValue(DataTypes.OBJ_LANGUAGE, "");
        setObjectValue(DataTypes.OBJ_DESCRIPTION, "");
        setObjectValue(DataTypes.OBJ_LYRICS, "");
    
public FrameBodyUSLT(FrameBodyUSLT body)
Copy constructor

param
body

        super(body);
    
public FrameBodyUSLT(byte textEncoding, String language, String description, String text)
Creates a new FrameBodyUSLT datatype.

param
textEncoding
param
language
param
description
param
text

        setObjectValue(DataTypes.OBJ_TEXT_ENCODING, textEncoding);
        setObjectValue(DataTypes.OBJ_LANGUAGE, language);
        setObjectValue(DataTypes.OBJ_DESCRIPTION, description);
        setObjectValue(DataTypes.OBJ_LYRICS, text);
    
public FrameBodyUSLT(ByteBuffer byteBuffer, int frameSize)
Creates a new FrameBodyUSLT datatype, populated from buffer

param
byteBuffer
param
frameSize
throws
InvalidTagException
throws
InvalidTagException

        super(byteBuffer, frameSize);
    
Methods Summary
public voidaddLyric(java.lang.String text)
Add additional lyric to the lyric field

param
text

        setLyric(getLyric() + text);
        
public voidaddLyric(Lyrics3Line line)

param
line

        setLyric(getLyric() + line.writeString());
    
public java.lang.StringgetDescription()
Get a description field

return
description

        return (String) getObjectValue(DataTypes.OBJ_DESCRIPTION);
    
public java.lang.StringgetFirstTextValue()
Get first value

return
value at index 0

        TextEncodedStringSizeTerminated text = (TextEncodedStringSizeTerminated) getObject(DataTypes.OBJ_LYRICS);
        return text.getValueAtIndex(0);
    
public java.lang.StringgetIdentifier()
The ID3v2 frame identifier

return
the ID3v2 frame identifier for this frame type

        return ID3v24Frames.FRAME_ID_UNSYNC_LYRICS;
    
public java.lang.StringgetLanguage()
Get the language field

return
language

        return (String) getObjectValue(DataTypes.OBJ_LANGUAGE);
    
public java.lang.StringgetLyric()
Get the lyric field

return
lyrics

        return (String) getObjectValue(DataTypes.OBJ_LYRICS);
    
public java.lang.StringgetUserFriendlyValue()

        return getFirstTextValue();
    
public voidsetDescription(java.lang.String description)
Set a description field

param
description

        setObjectValue(DataTypes.OBJ_DESCRIPTION, description);
    
public voidsetLanguage(java.lang.String language)
Set the language field

param
language

        setObjectValue(DataTypes.OBJ_LANGUAGE, language);
    
public voidsetLyric(java.lang.String lyric)
Set the lyric field

param
lyric

        setObjectValue(DataTypes.OBJ_LYRICS, lyric);
    
protected voidsetupObjectList()

        objectList.add(new NumberHashMap(DataTypes.OBJ_TEXT_ENCODING, this, TextEncoding.TEXT_ENCODING_FIELD_SIZE));
        objectList.add(new StringHashMap(DataTypes.OBJ_LANGUAGE, this, Languages.LANGUAGE_FIELD_SIZE));
        objectList.add(new TextEncodedStringNullTerminated(DataTypes.OBJ_DESCRIPTION, this));
        objectList.add(new TextEncodedStringSizeTerminated(DataTypes.OBJ_LYRICS, this));
    
public voidwrite(java.io.ByteArrayOutputStream tagBuffer)


        //Ensure valid for type
        this.setTextEncoding(ID3TextEncodingConversion.getTextEncoding(getHeader(), getTextEncoding()));

        //Ensure valid for data                    
        if (!((AbstractString) getObject(DataTypes.OBJ_DESCRIPTION)).canBeEncoded())
        {
            this.setTextEncoding(ID3TextEncodingConversion.getUnicodeTextEncoding(getHeader()));
        }
        if (!((AbstractString) getObject(DataTypes.OBJ_LYRICS)).canBeEncoded())
        {
            this.setTextEncoding(ID3TextEncodingConversion.getUnicodeTextEncoding(getHeader()));
        }
        super.write(tagBuffer);