org.apache.tika.parser.mp3
Class LyricsHandler

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

public class LyricsHandler
extends java.lang.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(java.io.InputStream stream, org.xml.sax.ContentHandler handler)
           
 
Method Summary
protected static byte[] getSuffix(java.io.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(java.io.InputStream stream,
                     org.xml.sax.ContentHandler handler)
              throws java.io.IOException,
                     org.xml.sax.SAXException,
                     TikaException
Throws:
java.io.IOException
org.xml.sax.SAXException
TikaException

LyricsHandler

protected LyricsHandler(byte[] tagData)
                 throws java.io.IOException,
                        org.xml.sax.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:
java.io.IOException
org.xml.sax.SAXException
TikaException
Method Detail

hasID3v1

public boolean hasID3v1()

hasLyrics

public boolean hasLyrics()

getSuffix

protected static byte[] getSuffix(java.io.InputStream stream,
                                  int length)
                           throws java.io.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:
java.io.IOException - if the stream could not be read from.


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