package org.farng.mp3.id3;
import org.farng.mp3.InvalidTagException;
import org.farng.mp3.object.ObjectNumberHashMap;
import org.farng.mp3.object.ObjectStringHashMap;
import org.farng.mp3.object.ObjectStringSizeTerminated;
import java.io.IOException;
import java.io.RandomAccessFile;
/**
* <h3>4.22. Terms of use frame</h3>
* <p/>
* <p> This frame contains a brief description of the terms of use and<br> ownership of the
* file. More detailed information concerning the legal<br> terms might be available through the
* "WCOP" frame. Newlines are<br> allowed in the text. There may be more than one 'Terms of use'
* frame<br>
* <p/>
* in a tag, but only one with the same 'Language'.</p>
* <p/>
* <p> <Header for 'Terms of use frame', ID: "USER"><br>
* Text encoding $xx<br>
* <p/>
* Language $xx xx xx<br>
* The actual text <text string according to encoding><br>
* </p>
*
* @author Eric Farng
* @version $Revision: 1.4 $
*/
public class FrameBodyUSER extends AbstractID3v2FrameBody {
/**
* Creates a new FrameBodyUSER object.
*/
public FrameBodyUSER() {
super();
}
/**
* Creates a new FrameBodyUSER object.
*/
public FrameBodyUSER(final FrameBodyUSER body) {
super(body);
}
/**
* Creates a new FrameBodyUSER object.
*/
public FrameBodyUSER(final byte textEncoding, final String language, final String text) {
setObject("Text Encoding", new Byte(textEncoding));
setObject("Language", language);
setObject("Text", text);
}
/**
* Creates a new FrameBodyUSER object.
*/
public FrameBodyUSER(final RandomAccessFile file) throws IOException, InvalidTagException {
this.read(file);
}
public String getIdentifier() {
return "USER" + ((char) 0) + getLanguage();
}
public String getLanguage() {
return (String) getObject(ObjectStringHashMap.LANGUAGE);
}
public void setOwner(final String language) {
setObject(ObjectStringHashMap.LANGUAGE, language);
}
protected void setupObjectList() {
appendToObjectList(new ObjectNumberHashMap(ObjectNumberHashMap.TEXT_ENCODING, 1));
appendToObjectList(new ObjectStringHashMap(ObjectStringHashMap.LANGUAGE, 3));
appendToObjectList(new ObjectStringSizeTerminated("Text"));
}
}