Methods Summary |
---|
public void | accept(ID3Visitor oID3Visitor)
oID3Visitor.visitCOMRID3V2Frame(this);
|
public boolean | equals(java.lang.Object oOther)
if ((oOther == null) || (!(oOther instanceof COMRID3V2Frame)))
{
return false;
}
COMRID3V2Frame oOtherCOMR = (COMRID3V2Frame)oOther;
return (m_oTextEncoding.equals(oOtherCOMR.m_oTextEncoding) &&
m_sPrice.equals(oOtherCOMR.m_sPrice) &&
m_sValidUntil.equals(oOtherCOMR.m_sValidUntil) &&
m_sContactUrl.equals(oOtherCOMR.m_sContactUrl) &&
(m_byReceivedAs == oOtherCOMR.m_byReceivedAs) &&
m_sNameOfSeller.equals(oOtherCOMR.m_sNameOfSeller) &&
m_sDescription.equals(oOtherCOMR.m_sDescription) &&
m_sPictureMimeType.equals(oOtherCOMR.m_sPictureMimeType) &&
Arrays.equals(m_abySellerLogoData, oOtherCOMR.m_abySellerLogoData));
|
public java.lang.String | getContactUrl()Get contact URL string.
return m_sContactUrl;
|
public java.lang.String | getDescription()Get description of item.
return m_sDescription;
|
protected byte[] | getFrameId()
return "COMR".getBytes();
|
public java.lang.String | getNameOfSeller()Get name of seller.
return m_sNameOfSeller;
|
public java.lang.String | getPrice()Get price.
return m_sPrice;
|
public byte | getReceivedAsFormat()Get received as format.
return m_byReceivedAs;
|
public byte[] | getSellerLogoData()Get image data for the seller logo.
return m_abySellerLogoData;
|
public java.lang.String | getSellerLogoMimeType()Get mime type of the seller logo image.
return m_sPictureMimeType;
|
public TextEncoding | getTextEncoding()Get the text encoding used for the name of seller and description in this frame.
return m_oTextEncoding;
|
public java.lang.String | getValidUntilDate()Get valid until date.
return m_sValidUntil;
|
public void | setCommercialInformation(java.lang.String sPrice, java.lang.String sValidUntil, java.lang.String sContactUrl, byte byReceivedAs, java.lang.String sNameOfSeller, java.lang.String sDescription, java.lang.String sPictureMimeType, byte[] abySellerLogoData)Set commercial information.
m_oTextEncoding = TextEncoding.getDefaultTextEncoding();
if (sPrice == null)
{
throw new ID3Exception("Price required in COMR frame.");
}
if ( ! sPrice.matches("(?uis)(\\w{3}\\d*\\.?\\d+/?)+"))
{
throw new ID3Exception("Invalid COMR frame price string.");
}
m_sPrice = sPrice;
if (sValidUntil == null)
{
throw new ID3Exception("Valid until date required in COMR frame.");
}
if ( ! sValidUntil.matches("(?uis)\\d{8}"))
{
throw new ID3Exception("Invalid COMR frame valid until date.");
}
m_sValidUntil = sValidUntil;
if (sContactUrl == null)
{
throw new ID3Exception("Contact URL required in COMR frame.");
}
m_sContactUrl = sContactUrl;
m_byReceivedAs = byReceivedAs;
if (sNameOfSeller == null)
{
throw new ID3Exception("Name of seller required in COMR frame.");
}
m_sNameOfSeller = sNameOfSeller;
if (sDescription == null)
{
throw new ID3Exception("Description required in COMR frame.");
}
m_sDescription = sDescription;
m_sPictureMimeType = sPictureMimeType;
if (m_sPictureMimeType == null)
{
m_sPictureMimeType = "image/";
}
m_abySellerLogoData = abySellerLogoData;
|
public void | setTextEncoding(TextEncoding oTextEncoding)Set the text encoding to be used for the name of seller and description in this frame.
if (oTextEncoding == null)
{
throw new NullPointerException("Text encoding cannot be null.");
}
m_oTextEncoding = oTextEncoding;
|
public java.lang.String | toString()
return "Commercial Frame: Price=[" + m_sPrice + "], Valid Until=[" + m_sValidUntil + "], Contact URL=[" +
m_sContactUrl + "], Received As=" + m_byReceivedAs + ", Name Of Seller=[" + m_sNameOfSeller +
"], Description=[" + m_sDescription + "], Picture Mime Type=[" + m_sPictureMimeType + "]";
|
protected void | writeBody(ID3DataOutputStream oIDOS)
// text encoding
oIDOS.writeUnsignedByte(m_oTextEncoding.getEncodingValue());
// price string
oIDOS.write(m_sPrice.getBytes());
oIDOS.writeUnsignedByte(0);
// valid until
oIDOS.write(m_sValidUntil.getBytes());
// contact url
oIDOS.write(m_sContactUrl.getBytes());
oIDOS.writeUnsignedByte(0);
// received as
oIDOS.writeUnsignedByte(m_byReceivedAs);
// name of seller
if (m_sNameOfSeller != null)
{
oIDOS.write(m_sNameOfSeller.getBytes(m_oTextEncoding.getEncodingString()));
}
// null terminating optional name of seller
if (m_oTextEncoding.equals(TextEncoding.ISO_8859_1))
{
oIDOS.writeUnsignedByte(0);
}
else
{
oIDOS.writeUnsignedByte(0);
oIDOS.writeUnsignedByte(0);
}
// description
if (m_sDescription != null)
{
oIDOS.write(m_sDescription.getBytes(m_oTextEncoding.getEncodingString()));
}
// null terminating optional description
if (m_oTextEncoding.equals(TextEncoding.ISO_8859_1))
{
oIDOS.writeUnsignedByte(0);
}
else
{
oIDOS.writeUnsignedByte(0);
oIDOS.writeUnsignedByte(0);
}
// optional company logo image
if (m_abySellerLogoData != null)
{
// image mime type (optional, "image/" assumed if not set)
if (m_sPictureMimeType != null)
{
oIDOS.write(m_sPictureMimeType.getBytes());
}
oIDOS.writeUnsignedByte(0); // terminating null
// actual image data
oIDOS.write(m_abySellerLogoData);
}
|