org.farng.mp3.id3.FrameBodyUSER Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jid3lib Show documentation
Show all versions of jid3lib Show documentation
This library reads song information, such as song title, artist, and album, from an MP3 file. It supports ID3v1, ID3v1.1, Lyrics3v1, Lyrics3v2, ID3v2.2, ID3v2.3, and ID3v2.4 tags. MP3 Frame Headers can also be read. There is a FilenameTag, a ID3v2.4 tag that is intelligently derived from the file name. It contains tag synchronization utilities, multiple save options, and easy tag conversion methods.
The newest version!
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;
/**
* 4.22. Terms of use frame
*
* This frame contains a brief description of the terms of use and
ownership of the
* file. More detailed information concerning the legal
terms might be available through the
* "WCOP" frame. Newlines are
allowed in the text. There may be more than one 'Terms of use'
* frame
*
* in a tag, but only one with the same 'Language'.
*
* <Header for 'Terms of use frame', ID: "USER">
* Text encoding $xx
*
* Language $xx xx xx
* The actual text <text string according to encoding>
*
*
* @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"));
}
}