public class ID3v24FrameBodyPopularimeter extends ID3v24FrameBody
A popularimeter frame body is associated with an ID3v2.4 POPM
frame
which is used to specify how much you like an .mp3 song.
The popularimeter frame body contains the following fields:
Field | Description | |
---|---|---|
1. | userEmail | user's e-mail address |
2. | rating | rating of the .mp3 song from 1 - 255, where 1 is the worst and 255 is best. 0 is unknown, ie, not yet rated. |
3. | counter | number of times the .mp3 song has been played. this field is optional. |
There may be more than one popularimeter frame in each tag, but only one with the same e-mail address.
Modifier and Type | Field and Description |
---|---|
static int |
BEST
highest rating possible
|
static int |
MIDDLE
average rating
|
static int |
UNKNOWN
the .mp3 song does not have a rating yet
|
static int |
WORST
lowest rating possible
|
buffer, dirty, frameType
nextNullTerminatorIndex, nullTerminatorIndex
Constructor and Description |
---|
ID3v24FrameBodyPopularimeter()
The default constructor is called when creating a new frame.
|
ID3v24FrameBodyPopularimeter(java.io.InputStream inputStream,
int frameBodySize)
This constructor is called when reading in an existing frame from an .mp3 file.
|
ID3v24FrameBodyPopularimeter(java.lang.String userEmail,
int rating,
int counter)
This constructor is called when creating a new frame.
|
Modifier and Type | Method and Description |
---|---|
int |
getCounter()
gets the number of times the song has been played.
|
int |
getRating()
gets the song's rating.
|
java.lang.String |
getUserEmail()
gets the user's e-mail address.
|
void |
parse()
parses the raw bytes of the frame body and stores the parsed values in the frame's fields.
|
void |
setBuffer()
If the frame body's values have been modified, then resize the raw binary buffer and store the new values there.
|
void |
setCounter(int counter)
sets the number of times the song has been played.
|
void |
setRating(int rating)
sets the rating of the song.
|
void |
setUserEmail(java.lang.String userEmail)
sets the user's e-mail address.
|
java.lang.String |
toString()
gets a string representation of the popularimeter frame body showing all of the frame's fields and their values.
|
getFrameType, getNextNullTerminator, getSize, isDirty, save, save
getNextNullTerminator, pricesToString, stringToBytes
bytesToInt, bytesToInt, bytesToShort, bytesToShort, bytesToSynchsafeInt, bytesToSynchsafeShort, formateDate, hex, hex, hex, intToBytes, littleEndianBytesToInt, pad, shortToBytes, synchsafeIntToBytes
public static final int UNKNOWN
public static final int WORST
public static final int MIDDLE
public static final int BEST
public ID3v24FrameBodyPopularimeter()
public ID3v24FrameBodyPopularimeter(java.lang.String userEmail, int rating, int counter)
userEmail
- user's e-mail.rating
- [1-255] where 1 = worst and 255 = best. 0 is unknown, ie, not yet rated.counter
- number of times the song has been played (optional).public ID3v24FrameBodyPopularimeter(java.io.InputStream inputStream, int frameBodySize) throws java.io.IOException
inputStream
- input stream pointing to a popularimeter frame body in the .mp3 file.frameBodySize
- size (in bytes) of the frame's body.java.io.IOException
- if there is an error while reading the frame body.public void parse() throws java.lang.IllegalArgumentException
parse
in class ID3v24FrameBody
java.lang.IllegalArgumentException
- if an invalid value is detected while parsing the frame body's raw bytes.public java.lang.String getUserEmail()
setUserEmail(String)
public void setUserEmail(java.lang.String userEmail)
userEmail
- the user's e-mail address.getUserEmail()
public int getRating()
setRating(int)
public void setRating(int rating)
rating
- [1-255] where 1 = worst and 255 = best. 0 is unknown, ie, not yet rated.getRating()
public int getCounter()
setCounter(int)
public void setCounter(int counter)
counter
- the number of times the song has been played.getCounter()
public void setBuffer()
setBuffer
in class ID3v24FrameBody
public java.lang.String toString()
toString
in class java.lang.Object