FileDocCategorySizeDatePackage
PCNTID3V2Frame.javaAPI Docjid3 0.463673Sun Feb 06 18:11:24 GMT 2005org.blinkenlights.jid3.v2

PCNTID3V2Frame

public class PCNTID3V2Frame extends ID3V2Frame
Frame containing a play counter. Note: There is no support for counter values greater than a 32-bit signed int. Will any track ever get played more than 2 billion times?
author
paul

Fields Summary
private int
m_iPlayCount
Constructors Summary
public PCNTID3V2Frame(int iPlayCount)
Creates a new instance of PCNTID3V2Frame

param
iPlayCount the current play count for this track
throws
ID3Exception if the play count specified is negative

        if (iPlayCount < 0)
        {
            throw new ID3Exception("Play count cannot be negative in PCNT frame.");
        }
        m_iPlayCount = iPlayCount;
    
public PCNTID3V2Frame(InputStream oIS)

        try
        {
            ID3DataInputStream oFrameDataID3DIS = new ID3DataInputStream(oIS);

            // play count
            m_iPlayCount = oFrameDataID3DIS.readBE32();
        }
        catch (Exception e)
        {
            throw new InvalidFrameID3Exception(e);
        }
    
Methods Summary
public voidaccept(ID3Visitor oID3Visitor)

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

        if ((oOther == null) || (!(oOther instanceof PCNTID3V2Frame)))
        {
            return false;
        }
        
        PCNTID3V2Frame oOtherPCNT = (PCNTID3V2Frame)oOther;
        
        return (m_iPlayCount == oOtherPCNT.m_iPlayCount);
    
protected byte[]getFrameId()

        return "PCNT".getBytes();
    
public intgetPlayCount()
Get play count.

return
the play count

        return m_iPlayCount;
    
public voidsetPlayCount(int iPlayCount)
Set the play count.

param
iPlayCount the current play count for this track
throws
ID3Exception if the play count specified is negative

        if (iPlayCount < 0)
        {
            throw new ID3Exception("Play count cannot be negative in PCNT frame.");
        }
        m_iPlayCount = iPlayCount;
    
public java.lang.StringtoString()

        return "Play counter: Play count=[" + m_iPlayCount + "]";
    
protected voidwriteBody(ID3DataOutputStream oIDOS)

        // play count
        oIDOS.writeBE32(m_iPlayCount);