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

ID3V1_0Tag

public class ID3V1_0Tag extends ID3V1Tag
author
paul ID3 V1.0 tag object.

Fields Summary
Constructors Summary
public ID3V1_0Tag()
Constructor for ID3 V1.0 Tag.

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

        oID3Visitor.visitID3V1_0Tag(this);
    
public voidsetComment(java.lang.String sComment)

        if (sComment.length() > 30)
        {
            sComment = sComment.substring(0, 30);
        }
        
        m_sComment = sComment;
    
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]);
            }
            // 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[30 - abyComment.length]);    // padding to equal 30 bytes for comment
            }
            else
            {
                oOS.write(new byte[30]);    // no value, just padding
            }
            // genre
            if (getGenre() != null)
            {
                oOS.write(getGenre().getByteValue());
            }
            else
            {
                oOS.write(0);
            }
        }
        catch (Exception e)
        {
            throw new ID3Exception(e);
        }