FileDocCategorySizeDatePackage
ID3V1_1Tag.javaAPI Docjid3 0.465310Sun Feb 06 18:11:26 GMT 2005org.blinkenlights.jid3.v1

ID3V1_1Tag

public class ID3V1_1Tag extends ID3V1Tag
author
paul ID3 V1.1 tag object.

Fields Summary
private int
m_iAlbumTrack
Constructors Summary
public ID3V1_1Tag()
Constructor for ID3 V1.1 tag.

    
              
     
    
        super();
    
Methods Summary
public voidaccept(ID3Visitor oID3Visitor)

        oID3Visitor.visitID3V1_1Tag(this);
    
public intgetAlbumTrack()
Get the album track number.

return
the set track number for this recording

        return m_iAlbumTrack;
    
public voidsetAlbumTrack(int iAlbumTrack)
Set the track number for this title on the album from which it came.

param
iAlbumTrack a track number from 1 to 255
throws
ID3Exception if the track number is outside the valid range

        if ((iAlbumTrack > 0) && (iAlbumTrack < 256))
        {
            m_iAlbumTrack = iAlbumTrack;
        }
        else
        {
            throw new ID3Exception("Illegal album track value " + iAlbumTrack + ".  Valid range from 1 to 255.");
        }
    
public voidsetComment(java.lang.String sComment)

        if (sComment.length() > 28)
        {
            sComment = sComment.substring(0, 28);
        }

        m_sComment = sComment;
    
public java.lang.StringtoString()

        return super.toString() + "\nAlbumTrack = " + m_iAlbumTrack;
    
public voidwrite(java.io.OutputStream oOS)

        try
        {
            oOS.write("TAG".getBytes());
            // song title
            if (getTitle() != null)
            {
                byte[] abySongTitle = getTitle().getBytes();
                oOS.write(abySongTitle);
                oOS.write(new byte[30 - abySongTitle.length]);  // padding to equal 30 bytes for song title
            }
            else
            {
                oOS.write(new byte[30]);    // no value, just padding
            }
            // artist
            if (getArtist() != null)
            {
                byte[] abyArtist = getArtist().getBytes();
                oOS.write(abyArtist);
                oOS.write(new byte[30 - abyArtist.length]); // padding to equal 30 bytes for artist
            }
            else
            {
                oOS.write(new byte[30]);    // no value, just padding
            }
            // album
            if (getAlbum() != null)
            {
                byte[] abyAlbum = getAlbum().getBytes();
                oOS.write(abyAlbum);
                oOS.write(new byte[30 - abyAlbum.length]);  // padding to equal 30 bytes for album
            }
            else
            {
                oOS.write(new byte[30]);    // no value, just padding
            }
            // year
            if (getYear() != null)
            {
                byte[] abyYear = getYear().getBytes();
                oOS.write(abyYear);
                oOS.write(new byte[4 - abyYear.length]);    // padding to equal 4 bytes for year
            }
            else
            {
                oOS.write(new byte[4]);     // no value, just padding
            }
            // comment
            if (getComment() != null)
            {
                byte[] abyComment = getComment().getBytes();
                oOS.write(abyComment);
                oOS.write(new byte[28 - abyComment.length]);    // padding to equal 28 bytes for comment (plus one terminating one)
            }
            else
            {
                oOS.write(new byte[28]);    // no value, just padding
            }
            // separator byte
            oOS.write(0);
            // album track
            oOS.write(getAlbumTrack());
            // genre
            if (getGenre() != null)
            {
                oOS.write(getGenre().getByteValue());
            }
            else
            {
                oOS.write(0);
            }
        }
        catch (Exception e)
        {
            throw new ID3Exception(e);
        }