Methods Summary |
---|
public void | accept(ID3Visitor oID3Visitor)
oID3Visitor.visitCOMMID3V2Frame(this);
|
public boolean | equals(java.lang.Object oOther)
if ((oOther == null) || (!(oOther instanceof COMMID3V2Frame)))
{
return false;
}
COMMID3V2Frame oOtherCOMM = (COMMID3V2Frame)oOther;
return ((m_oTextEncoding.equals(oOtherCOMM.m_oTextEncoding)) &&
m_sLanguage.equals(oOtherCOMM.m_sLanguage) &&
m_sShortDescription.equals(oOtherCOMM.m_sShortDescription) &&
m_sActualText.equals(oOtherCOMM.m_sActualText));
|
public java.lang.String | getActualText()Get the actual text of the comment.
return m_sActualText;
|
protected byte[] | getFrameId()
return "COMM".getBytes();
|
public java.lang.String | getLanguage()Get the language of this comment.
return m_sLanguage;
|
public java.lang.String | getShortDescription()Get the short description of this comment.
return m_sShortDescription;
|
public TextEncoding | getTextEncoding()Get the text encoding used for the short description and actual text in this frame.
return m_oTextEncoding;
|
public void | setComment(java.lang.String sLanguage, java.lang.String sShortDescription, java.lang.String sActualText)Set the language of this comment.
TextEncoding oOrigTextEncoding = m_oTextEncoding;
String sOrigLanguage = m_sLanguage;
String sOrigShortDescription = m_sShortDescription;
String sOrigActualText = m_sActualText;
if ((sLanguage == null) || (sLanguage.length() != 3))
{
throw new ID3Exception("Language string in COMM frame must have length of 3.");
}
if (sActualText == null)
{
throw new ID3Exception("Comment text is required in COMM frame.");
}
m_oTextEncoding = TextEncoding.getDefaultTextEncoding();
m_sLanguage = sLanguage;
m_sShortDescription = sShortDescription;
if (m_sShortDescription == null)
{
m_sShortDescription = "";
}
m_sActualText = sActualText;
// try this update, and reverse it if it generates an error
try
{
notifyID3Observers();
}
catch (ID3Exception e)
{
m_sLanguage = sOrigLanguage;
m_sShortDescription = sShortDescription;
m_sActualText = sOrigActualText;
m_oTextEncoding = oOrigTextEncoding;
throw e;
}
|
public void | setLanguage(java.lang.String sLanguage)Set the language of this comment.
String sOrigLanguage = m_sLanguage;
if ((sLanguage == null) || (sLanguage.length() != 3))
{
throw new ID3Exception("Language string in COMM frame must have length of 3.");
}
m_sLanguage = sLanguage;
// try this update, and reverse it if it generates an error
try
{
notifyID3Observers();
}
catch (ID3Exception e)
{
m_sLanguage = sOrigLanguage;
throw e;
}
|
public void | setTextEncoding(TextEncoding oTextEncoding)Set the text encoding to be used for the short description and actual text in this frame.
if (oTextEncoding == null)
{
throw new NullPointerException("Text encoding cannot be null.");
}
m_oTextEncoding = oTextEncoding;
|
public java.lang.String | toString()
return "Comment: Language=[" + m_sLanguage + "], Short description=[" +
m_sShortDescription + "], Actual text=[" + m_sActualText + "]";
|
protected void | writeBody(ID3DataOutputStream oIDOS)
// text encoding
oIDOS.writeUnsignedByte(m_oTextEncoding.getEncodingValue());
// language
oIDOS.write(m_sLanguage.getBytes());
// short description
if (m_sShortDescription != null)
{
oIDOS.write(m_sShortDescription.getBytes(m_oTextEncoding.getEncodingString()));
}
// null separating description from picture data
if (m_oTextEncoding.equals(TextEncoding.ISO_8859_1))
{
oIDOS.writeUnsignedByte(0);
}
else
{
oIDOS.writeUnsignedByte(0);
oIDOS.writeUnsignedByte(0);
}
// actual text of comment
oIDOS.write(m_sActualText.getBytes(m_oTextEncoding.getEncodingString()));
|