FileDocCategorySizeDatePackage
Lyrics3Line.javaAPI DocJaudiotagger 2.0.45864Wed Mar 30 16:12:12 BST 2011org.jaudiotagger.tag.datatype

Lyrics3Line

public class Lyrics3Line extends AbstractDataType
author
: Paul Taylor
author
: Eric Farng Version @version:$Id: Lyrics3Line.java 836 2009-11-12 15:44:07Z paultaylor $ MusicTag Copyright (C)2003,2004 This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, you can get a copy from http://www.opensource.org/licenses/lgpl-license.php or write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Description:

Fields Summary
private LinkedList
timeStamp
private String
lyric
Constructors Summary
public Lyrics3Line(String identifier, org.jaudiotagger.tag.id3.AbstractTagFrameBody frameBody)
Creates a new ObjectLyrics3Line datatype.

param
identifier
param
frameBody


                  
        
    
        super(identifier, frameBody);
    
public Lyrics3Line(Lyrics3Line copy)

        super(copy);
        this.lyric = copy.lyric;
        Lyrics3TimeStamp newTimeStamp;
        for (int i = 0; i < copy.timeStamp.size(); i++)
        {
            newTimeStamp = new Lyrics3TimeStamp(copy.timeStamp.get(i));
            this.timeStamp.add(newTimeStamp);
        }
    
Methods Summary
public voidaddLyric(ID3v2LyricLine line)

        this.lyric += line.getText();
    
public voidaddLyric(java.lang.String newLyric)

        this.lyric += newLyric;
    
public voidaddTimeStamp(Lyrics3TimeStamp time)

param
time

        timeStamp.add(time);
    
public booleanequals(java.lang.Object obj)

param
obj
return

        if (!(obj instanceof Lyrics3Line))
        {
            return false;
        }
        Lyrics3Line object = (Lyrics3Line) obj;
        if (!this.lyric.equals(object.lyric))
        {
            return false;
        }
        return this.timeStamp.equals(object.timeStamp) && super.equals(obj);
    
public java.lang.StringgetLyric()

return

        return lyric;
    
public intgetSize()

return

        int size = 0;
        for (Object aTimeStamp : timeStamp)
        {
            size += ((Lyrics3TimeStamp) aTimeStamp).getSize();
        }
        return size + lyric.length();
    
public java.util.IteratorgetTimeStamp()

return

        return timeStamp.iterator();
    
public booleanhasTimeStamp()

return

        return !timeStamp.isEmpty();
    
public voidreadByteArray(byte[] arr, int offset)

        readString(arr.toString(), offset);
    
public voidreadString(java.lang.String lineString, int offset)

param
lineString
param
offset
throws
NullPointerException
throws
IndexOutOfBoundsException

        if (lineString == null)
        {
            throw new NullPointerException("Image is null");
        }
        if ((offset < 0) || (offset >= lineString.length()))
        {
            throw new IndexOutOfBoundsException("Offset to line is out of bounds: offset = " + offset + ", line.length()" + lineString.length());
        }
        int delim;
        Lyrics3TimeStamp time;
        timeStamp = new LinkedList<Lyrics3TimeStamp>();
        delim = lineString.indexOf("[", offset);
        while (delim >= 0)
        {
            offset = lineString.indexOf("]", delim) + 1;
            time = new Lyrics3TimeStamp("Time Stamp");
            time.readString(lineString.substring(delim, offset));
            timeStamp.add(time);
            delim = lineString.indexOf("[", offset);
        }
        lyric = lineString.substring(offset);
    
public voidsetLyric(java.lang.String lyric)

        this.lyric = lyric;
    
public voidsetLyric(ID3v2LyricLine line)

        this.lyric = line.getText();
    
public voidsetTimeStamp(Lyrics3TimeStamp time)

param
time

        timeStamp.clear();
        timeStamp.add(time);
    
public java.lang.StringtoString()

return

        String str = "";
        for (Object aTimeStamp : timeStamp)
        {
            str += aTimeStamp.toString();
        }
        return "timeStamp = " + str + ", lyric = " + lyric + "\n";
    
public byte[]writeByteArray()

        return Utils.getDefaultBytes(writeString(), "ISO8859-1");
    
public java.lang.StringwriteString()

return

        String str = "";
        Lyrics3TimeStamp time;
        for (Object aTimeStamp : timeStamp)
        {
            time = (Lyrics3TimeStamp) aTimeStamp;
            str += time.writeString();
        }
        return str + lyric;