sk.baka.ambient.lrc
Class LRCLyrics

java.lang.Object
  extended by sk.baka.ambient.lrc.LRCLyrics

public final class LRCLyrics
extends Object

Parses the LRC karaoke format (more on wiki). Thread-safe.

Author:
Martin Vysny

Method Summary
 SortedMap<Long,String> getLines()
          Returns all lines in this lyrics instance.
 String getLineToDisplay(long time)
          Returns line which should be displayed at given time.
 long getNextLineTime(long time)
          Returns next line time.
static LRCLyrics parse(InputStream in)
          Parses given LRC file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLines

public SortedMap<Long,String> getLines()
Returns all lines in this lyrics instance.

Returns:
unmodifiable map of all lyrics.

getLineToDisplay

public String getLineToDisplay(long time)
Returns line which should be displayed at given time.

Parameters:
time - the time.
Returns:
line to be displayed, never null, may be empty.

getNextLineTime

public long getNextLineTime(long time)
Returns next line time. Returned time is always greater than the time given.

Parameters:
time - current time.
Returns:
nearest next time of line to be displayed. May return -1 if there is no such line.

parse

public static LRCLyrics parse(InputStream in)
                       throws IOException,
                              ParseException
Parses given LRC file

Parameters:
in - the file to parse. The stream is always closed, even in cause of an exception
Returns:
a lyrics holder instance.
Throws:
IOException - if i/o error occurs.
ParseException - if parse error occurs


Copyright © 2007-2008. All Rights Reserved.