public class ID3v23FrameBodyCommercial extends ID3v23FrameBody
A commercial frame body is associated with an ID3v2.3 COMR
frame
which allows vendors to include a price offer in an .mp3 file.
The commercial frame body contains the following fields:
Field | Description | |
---|---|---|
1. | encoding | character set used to encode the seller and description fields. |
2. | prices | the purchase price of the .mp3 file. The purchase price may be specified in equivalent currencies. For
example, USD1.00 = GBP0.60 = EUR1.25, etc. However, there may only be one price for a given currency. That is, you may not specify USD1.00 and USD2.00. |
3. | validUntil | date in the format YYYYMMDD indicating how long the price(s) are valid for. |
4. | contactURL | URL or e-mail address with which the seller can be contacted. |
5. | receivedAs | indicates how the .mp3 audio file will be delivered after is has been bought. |
6. | seller | name of the vendor. |
7. | description | description of the .mp3 file. |
8. | pictureMimeType | an optional field that specifies the vendor's logo image mime type. Only image/png and image/jpeg are allowed. If omitted, image/ will be used. |
9. | sellerLogo | an optional field that contains the raw binary data of the the vendor's logo image. Both this field and the previous pictureMimeType field may be ommitted if the vendor does not have a logo image to attach. |
There may be more than one commercial frame in an ID3v2.3 tag
, but only one with the same seller.
Modifier and Type | Class and Description |
---|---|
static class |
ID3v23FrameBodyCommercial.ReceivedType
valid ID3v2.3 commercial received as types
|
buffer, dirty, frameType
nextNullTerminatorIndex, nullTerminatorIndex
Constructor and Description |
---|
ID3v23FrameBodyCommercial()
The default constructor is called when creating a new frame.
|
ID3v23FrameBodyCommercial(Encoding encoding,
java.util.List<Price> prices,
java.lang.String validUntil,
java.lang.String contactURL,
ID3v23FrameBodyCommercial.ReceivedType receivedAs,
java.lang.String seller,
java.lang.String description,
java.lang.String pictureMimeType,
byte[] sellerLogo)
This constructor is called when creating a new frame.
|
ID3v23FrameBodyCommercial(java.io.InputStream inputStream,
int frameBodySize)
This constructor is called when reading in an existing frame from an .mp3 file.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getContactURL()
gets the url at which the seller can be contacted.
|
java.lang.String |
getDescription()
gets the description of the song.
|
Encoding |
getEncoding()
gets the character encoding of the seller and description fields.
|
java.lang.String |
getPictureMimeType()
gets the mime type of the seller's logo.
|
java.util.List<Price> |
getPrices()
gets the price(s) of the .mp3 song.
|
ID3v23FrameBodyCommercial.ReceivedType |
getReceivedAs()
gets how the song was delivered to the buyer.
|
java.lang.String |
getSeller()
gets the name of the seller.
|
byte[] |
getSellerLogo()
gets the raw bytes of the seller's logo image.
|
java.lang.String |
getValidUntil()
gets the date until which the price is valid.
|
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 |
setContactURL(java.lang.String contactURL)
sets the contact URL.
|
void |
setDescription(java.lang.String description)
sets the description of the song.
|
void |
setEncoding(Encoding encoding)
sets the character encoding of the seller and description fields.
|
void |
setPictureMimeType(java.lang.String pictureMimeType)
sets the seller's logo's mime type.
|
void |
setPrices(java.util.List<Price> prices)
sets the price(s) of the .mp3 song.
|
void |
setReceivedAs(ID3v23FrameBodyCommercial.ReceivedType receivedAs)
sets how the song was delivered to the buyer.
|
void |
setSeller(java.lang.String seller)
sets the name of the seller.
|
void |
setSellerLogo(byte[] sellerLogo)
sets the raw bytes of the seller's logo image.
|
void |
setValidUntil(java.lang.String validUntil)
sets how long the price is valid until.
|
java.lang.String |
toString()
gets a string representation of the commercial 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 ID3v23FrameBodyCommercial()
setReceivedAs(com.beaglebuddy.id3.v23.frame_body.ID3v23FrameBodyCommercial.ReceivedType)
public ID3v23FrameBodyCommercial(Encoding encoding, java.util.List<Price> prices, java.lang.String validUntil, java.lang.String contactURL, ID3v23FrameBodyCommercial.ReceivedType receivedAs, java.lang.String seller, java.lang.String description, java.lang.String pictureMimeType, byte[] sellerLogo)
encoding
- character set used to encode the seller and the description fields.prices
- price(s) paid for the song.validUntil
- date until which the price is valid in the format YYYYMMDD.contactURL
- url for contacting the seller.receivedAs
- how the song was delivered to the buyer.seller
- name of the seller.description
- description of the song.pictureMimeType
- mime type of the seller's logo image. this field is optional and may be set to null.sellerLogo
- seller's logo image. this field is optional and may be set to null.public ID3v23FrameBodyCommercial(java.io.InputStream inputStream, int frameBodySize) throws java.io.IOException
inputStream
- input stream pointing to a commercial 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 ID3v23FrameBody
java.lang.IllegalArgumentException
- if an invalid value is detected while parsing the frame body's raw bytes.public Encoding getEncoding()
setEncoding(Encoding)
public void setEncoding(Encoding encoding)
encoding
- the character set used to encode of the seller and description fields. Only ISO 8859-1 and UTF-16 are allowed.getEncoding()
public java.util.List<Price> getPrices()
setPrices(List)
public void setPrices(java.util.List<Price> prices)
prices
- price(s) paid for the .mp3 file.getPrices()
public java.lang.String getValidUntil()
setValidUntil(String)
public void setValidUntil(java.lang.String validUntil)
validUntil
- the date until which the price is valid.getValidUntil()
public java.lang.String getContactURL()
setContactURL(String)
public void setContactURL(java.lang.String contactURL)
contactURL
- the url at which the seller can be contacted.getContactURL()
public ID3v23FrameBodyCommercial.ReceivedType getReceivedAs()
setReceivedAs(ReceivedType)
public void setReceivedAs(ID3v23FrameBodyCommercial.ReceivedType receivedAs)
Id | Delivery Method |
---|---|
0 | other |
1 | standard CD album with other songs |
2 | compressed audio on CD |
3 | file over the Internet |
4 | stream over the Internet |
5 | as note sheets |
6 | as note sheets in a book with other sheets |
7 | music on other media |
8 | non-musical merchandise |
receivedAs
- how the song was received by the buyer.getReceivedAs()
public java.lang.String getSeller()
setSeller(String)
public void setSeller(java.lang.String seller)
seller
- the seller's name.getSeller()
public java.lang.String getDescription()
setDescription(String)
public void setDescription(java.lang.String description)
description
- the description of the song.getDescription()
public java.lang.String getPictureMimeType()
setPictureMimeType(String)
public void setPictureMimeType(java.lang.String pictureMimeType)
pictureMimeType
- the mime type of the seller's logo.getPictureMimeType()
public byte[] getSellerLogo()
setSellerLogo(byte[])
public void setSellerLogo(byte[] sellerLogo)
sellerLogo
- how the song was received by the buyer.getSellerLogo()
public void setBuffer()
setBuffer
in class ID3v23FrameBody
public java.lang.String toString()
toString
in class java.lang.Object