org.apache.tika.parser.mp3
Class LyricsHandler

java.lang.Object
  extended by org.apache.tika.parser.mp3.LyricsHandler

public class LyricsHandler
extends Object

This is used to parse Lyrics3 tag information from an MP3 file, if available. Handles lyrics tags of up to 10kb in size. Will process any ID3v1 tag data if present. Ignores extended ID3v1 data in the lyrics block

See Also:
Lyrics3 v2.0 specification

Constructor Summary
protected LyricsHandler(byte[] tagData)
          Looks for the Lyrics data, which will be just before the ID3v1 data (if present), and process it.
  LyricsHandler(InputStream stream, ContentHandler handler)
           
 
Method Summary
protected static byte[] getSuffix(InputStream stream, int length)
          Reads and returns the last length bytes from the given stream.
 boolean hasID3v1()
           
 boolean hasLyrics()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LyricsHandler

public LyricsHandler(InputStream stream,
                     ContentHandler handler)
              throws IOException,
                     SAXException,
                     TikaException
Throws:
IOException
SAXException
TikaException

LyricsHandler

protected LyricsHandler(byte[] tagData)
                 throws IOException,
                        SAXException,
                        TikaException
Looks for the Lyrics data, which will be just before the ID3v1 data (if present), and process it. Also sets things up for the ID3v1 processing if required. Creates from the last 128 bytes of a stream.

Throws:
IOException
SAXException
TikaException
Method Detail

hasID3v1

public boolean hasID3v1()

hasLyrics

public boolean hasLyrics()

getSuffix

protected static byte[] getSuffix(InputStream stream,
                                  int length)
                           throws IOException
Reads and returns the last length bytes from the given stream.

Parameters:
stream - input stream
length - number of bytes from the end to read and return
Returns:
stream the InputStream to read from.
Throws:
IOException - if the stream could not be read from.


Copyright © 2007-2012 The Apache Software Foundation. All Rights Reserved.