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

Lyrics3TimeStamp

public class Lyrics3TimeStamp extends AbstractDataType
author
: Paul Taylor
author
: Eric Farng Version @version:$Id: Lyrics3TimeStamp.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 long
minute
private long
second
Constructors Summary
public Lyrics3TimeStamp(String identifier, org.jaudiotagger.tag.id3.AbstractTagFrameBody frameBody)
Creates a new ObjectLyrics3TimeStamp datatype.

param
identifier
param
frameBody

        super(identifier, frameBody);
    
public Lyrics3TimeStamp(String identifier)

        super(identifier, null);
    
public Lyrics3TimeStamp(Lyrics3TimeStamp copy)

        super(copy);
        this.minute = copy.minute;
        this.second = copy.second;
    
Methods Summary
public booleanequals(java.lang.Object obj)

param
obj
return

        if (!(obj instanceof Lyrics3TimeStamp))
        {
            return false;
        }

        Lyrics3TimeStamp object = (Lyrics3TimeStamp) obj;

        if (this.minute != object.minute)
        {
            return false;
        }

        return this.second == object.second && super.equals(obj);

    
public longgetMinute()

return

        return minute;
    
public longgetSecond()

return

        return second;
    
public intgetSize()

return

        return 7;
    
public voidreadByteArray(byte[] arr, int offset)

        readString(arr.toString(), offset);
    
public voidreadString(java.lang.String s)
Todo this is wrong

param
s


               
       
    
    
public voidreadString(java.lang.String timeStamp, int offset)

param
timeStamp
param
offset
throws
NullPointerException
throws
IndexOutOfBoundsException

        if (timeStamp == null)
        {
            throw new NullPointerException("Image is null");
        }

        if ((offset < 0) || (offset >= timeStamp.length()))
        {
            throw new IndexOutOfBoundsException("Offset to timeStamp is out of bounds: offset = " + offset + ", timeStamp.length()" + timeStamp.length());
        }

        timeStamp = timeStamp.substring(offset);

        if (timeStamp.length() == 7)
        {
            minute = Integer.parseInt(timeStamp.substring(1, 3));
            second = Integer.parseInt(timeStamp.substring(4, 6));
        }
        else
        {
            minute = 0;
            second = 0;
        }
    
public voidsetMinute(long minute)

        this.minute = minute;
    
public voidsetSecond(long second)

        this.second = second;
    
public voidsetTimeStamp(long timeStamp, byte timeStampFormat)
Creates a new ObjectLyrics3TimeStamp datatype.

param
timeStamp
param
timeStampFormat

        /**
         * @todo convert both types of formats
         */
        timeStamp = timeStamp / 1000;
        minute = timeStamp / 60;
        second = timeStamp % 60;
    
public java.lang.StringtoString()

return

        return writeString();
    
public byte[]writeByteArray()

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

return

        String str;
        str = "[";

        if (minute < 0)
        {
            str += "00";
        }
        else
        {
            if (minute < 10)
            {
                str += '0";
            }

            str += Long.toString(minute);
        }

        str += ':";

        if (second < 0)
        {
            str += "00";
        }
        else
        {
            if (second < 10)
            {
                str += '0";
            }

            str += Long.toString(second);
        }

        str += ']";

        return str;