Methods Summary |
---|
public void | accept(ID3Visitor oID3Visitor)
oID3Visitor.visitTCONTextInformationID3V2Frame(this);
|
private ContentType | convertStringToContentType(java.lang.String sContentType)Internal method to convert a string in the format stored in a frame, to a content type object.
ContentType oContentType = new ContentType();
try
{
String sPiece = null;
while ((sPiece = getNextPiece(sContentType)).length() > 0)
{
// is piece a refinement?
if ((sPiece.charAt(0) != '(") || (sPiece.startsWith("((")))
{
oContentType.setRefinement(sPiece);
}
// cover?
else if (sPiece.toUpperCase().equals("(CR)"))
{
oContentType.setIsCover(true);
}
// remix?
else if (sPiece.toUpperCase().equals("(RX)"))
{
oContentType.setIsRemix(true);
}
// valid genre?
else
{
String sGenreValue = sPiece.substring(1, sPiece.length()-1);
int iGenreValue = Integer.parseInt(sGenreValue);
try
{
ContentType.Genre oGenre = ContentType.Genre.lookupGenre(iGenreValue);
oContentType.setGenre(oGenre);
}
catch (Exception e)
{
if (ID3Tag.usingStrict())
{
throw e;
}
// else, skip what we can't parse
}
}
sContentType = sContentType.substring(sPiece.length());
}
}
catch (ID3Exception e)
{
throw e;
}
catch (Exception e)
{
throw new ID3Exception("Encountered corrupt content type value in tag.", e);
}
return oContentType;
|
public boolean | equals(java.lang.Object oOther)
if ((oOther == null) || (!(oOther instanceof TCONTextInformationID3V2Frame)))
{
return false;
}
TCONTextInformationID3V2Frame oOtherTCON = (TCONTextInformationID3V2Frame)oOther;
return (m_oContentType.equals(oOtherTCON.m_oContentType) &&
m_oTextEncoding.equals(oOtherTCON.m_oTextEncoding) &&
m_sInformation.equals(oOtherTCON.m_sInformation));
|
public ContentType | getContentType()Get the content type from this frame.
return m_oContentType;
|
protected byte[] | getFrameId()
return "TCON".getBytes();
|
private java.lang.String | getNextPiece(java.lang.String sContentType)Internal method to help in parsing a string value to a ContentType.
// there's nothing in an empty string
if (sContentType.length() == 0)
{
return "";
}
// it's all refinement
if ((sContentType.charAt(0) != '(") || (sContentType.startsWith("((")))
{
return sContentType;
}
// there's a piece to return here
return sContentType.substring(0, sContentType.indexOf(')")+1);
|
public ContentType | setContentType(ContentType oContentType)Set the content type (genre) of this frame.
ContentType oOldContentType = m_oContentType;
m_oContentType = oContentType;
m_oTextEncoding = TextEncoding.getDefaultTextEncoding();
m_sInformation = oContentType.toString();
return oOldContentType;
|
public java.lang.String | toString()
return "Content type: [" + m_sInformation + "]";
|