public class Lyrics3v1Tag
extends java.lang.Object
This class provides methods for reading the optional Lyrics3v1 tag , which is found at the end of an .mp3 file after the mpeg audio data and before the ID3v1.x tag as shown below. It is an obsolete tag that really should just be removed from your .mp3 files. See the CleanMP3Files.java file provided in the sample code to see how this is done.
import java.io.IOException;
import com.beaglebuddy.mp3.MP3;
import com.beaglebuddy.lyrics3.v1.Lyrics3v1Tag;
public class Lyrics3v1Example
{
public static void main(String[] args)
{
try
{
MP3 mp3 = new MP3("c:/mp3/Wild Cat.mp3");
if (mp3.hasLyrics3v1Tag()) // if the mp3 file has a Lyrics3v1 tag
{ // then display the lyrics in it
Lyrics3v1Tag lyrics3v1Tag = mp3.getLyrics3v1Tag();
System.out.println("mp3 contains a Lyrics3v1 tag");
System.out.println(lyrics3v1Tag.getLyrics());
}
}
catch (IOException ex)
{
System.out.println("An error occurred while reading the mp3 file.");
}
}
}
Lyrics3v2Tag
,
Lyrics3v1 Spec,
Lyrics3v2 SpecConstructor and Description |
---|
Lyrics3v1Tag(java.io.RandomAccessFile file)
constructor used to read in a Lyrics3v1 tag from an .mp3 file.
|
Modifier and Type | Method and Description |
---|---|
int |
getFilePosition()
get the position (in bytes) within the .mp3 file where the Lyrics3v1 tag starts.
|
java.lang.String |
getLyrics()
gets the lyrics to the song.
|
int |
getSize()
get the size (in bytes) of the entire Lyrics3v1 tag, including the end id.
|
java.lang.String |
toString()
gets a string representation of the Lyrics3v1 tag.
|
public Lyrics3v1Tag(java.io.RandomAccessFile file) throws java.io.IOException, ParseException
file
- random access file to read in the Lyrics3v1 tag from an .mp3 file.java.io.IOException
- if there is an error while reading the Lyrics3v1 tag.ParseException
- if a Lyrics3v1 tag can not be found or if an invalid value is detected while parsing the Lyrics3v1 tag.public int getSize()
public int getFilePosition()
public java.lang.String getLyrics()
public java.lang.String toString()
toString
in class java.lang.Object