FileDocCategorySizeDatePackage
TYERTextInformationID3V2Frame.javaAPI Docjid3 0.464313Sun Feb 06 18:11:21 GMT 2005org.blinkenlights.jid3.v2

TYERTextInformationID3V2Frame

public class TYERTextInformationID3V2Frame extends TextInformationID3V2Frame
author
paul Text frame containing the year of the recording.

Fields Summary
private int
m_iYear
Constructors Summary
public TYERTextInformationID3V2Frame(int iYear)
Constructor.

param
iYear the year in which the recording in this track was recorded
throws
ID3Exception if the year is outside of the range from 0 to 9999

        super(Integer.toString(iYear));

        // it is required that the year value string be four characters long              
        if ((iYear < 0) || (iYear > 9999))
        {
            throw new ID3Exception("Year value must be between 0 and 9999.");
        }
        
        m_iYear = iYear;
    
public TYERTextInformationID3V2Frame(InputStream oIS)

        super(oIS);
        
        try
        {
            m_iYear = Integer.parseInt(m_sInformation);
        }
        catch (Exception e)
        {
            throw new InvalidFrameID3Exception("Encountered a corrupt TYER year frame.", e);
        }
    
Methods Summary
public voidaccept(ID3Visitor oID3Visitor)

        oID3Visitor.visitTYERTextInformationID3V2Frame(this);
    
public booleanequals(java.lang.Object oOther)

        if ((oOther == null) || (!(oOther instanceof TYERTextInformationID3V2Frame)))
        {
            return false;
        }
        
        TYERTextInformationID3V2Frame oOtherTYER = (TYERTextInformationID3V2Frame)oOther;
        
        return ( (m_iYear == oOtherTYER.m_iYear) &&
                 m_oTextEncoding.equals(oOtherTYER.m_oTextEncoding) &&
                 m_sInformation.equals(oOtherTYER.m_sInformation) );
    
protected byte[]getFrameId()

        return "TYER".getBytes();
    
public intgetYear()
Get the year of the recording in this track.

return
the year of the recording in this track

        return m_iYear;
    
private static java.lang.StringgetYearString(int iYear)
Internal method to return the year value as a four digit string.

        NumberFormat oNF = new DecimalFormat("0000");
        
        return oNF.format(iYear);
    
public voidsetYear(int iYear)
Set the year of the recording in this track.

param
iYear the year in which the recording in this track was recorded
throws
ID3Exception if the year is outside of the range from 0 to 9999

        // it is required that the year value string be four characters long              
        if ((iYear < 0) || (iYear > 9999))
        {
            throw new ID3Exception("Year in TYER tag must be between 0 and 9999.");
        }
        
        m_iYear = iYear;
        m_oTextEncoding = TextEncoding.getDefaultTextEncoding();
        m_sInformation = getYearString(iYear);
    
public java.lang.StringtoString()

        return "Year: [" + m_sInformation + "]";