net.shredzone.ifish.ltr
Class TagMp3v2

java.lang.Object
  extended by net.shredzone.ifish.ltr.LTR
      extended by net.shredzone.ifish.ltr.LTRmp3
          extended by net.shredzone.ifish.ltr.TagMp3v2

public class TagMp3v2
extends LTRmp3

Decodes an MP3 file with ID3v2 tag. The file is compliant to the specifications found at www.id3.org, V2.4.0 and V2.3.0. ID3 V2.2.0 is handled in a separate tag handler. Anyhow it has certain limitations regarding tag frames which could not be used or entirely used to iFish, e.g. multiple genres.

Version:
$Id: TagMp3v2.java 338 2009-06-28 23:15:58Z shred $

Field Summary
 
Fields inherited from class net.shredzone.ifish.ltr.LTR
factory, in
 
Constructor Summary
TagMp3v2(RandomAccessFile in, LTRFactory factory)
          Create a new TagMp3v2 instance.
 
Method Summary
 String getAlbum()
          Get the album.
 String getArtist()
          Get the artist.
 String getComment()
          Get the comment.
 String getGenre()
          Get the genre.
 String getTitle()
          Get the title.
 String getTrack()
          Get the track.
 String getType()
          Get the type of this file.
 String getYear()
          Get the year.
protected  int readAutoInt()
          Read an ID3v2 integer.
protected  net.shredzone.ifish.ltr.TagMp3v2.Frame readFrame()
          Read a tag frame.
 
Methods inherited from class net.shredzone.ifish.ltr.LTRmp3
decodeGenre, readInt, readSyncsafe, readSyncsafeInt
 
Methods inherited from class net.shredzone.ifish.ltr.LTR
readStringLen, readStringLen, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TagMp3v2

public TagMp3v2(RandomAccessFile in,
                LTRFactory factory)
         throws FormatDecodeException
Create a new TagMp3v2 instance.

Parameters:
in - File to be read
factory - Reference to the LTRFactory
Throws:
FormatDecodeException - Couldn't decode this file
Method Detail

getType

public String getType()
Get the type of this file. This is usually the compression format itself (e.g. "OGG" or "MP3"). If there are different taggings for this format, the used tag format is appended after a slash (e.g. "MP3/id3v2").

Specified by:
getType in class LTR
Returns:
The type

getArtist

public String getArtist()
Get the artist.

Specified by:
getArtist in class LTR
Returns:
The artist (never null)

getAlbum

public String getAlbum()
Get the album.

Specified by:
getAlbum in class LTR
Returns:
The album (never null)

getTitle

public String getTitle()
Get the title.

Specified by:
getTitle in class LTR
Returns:
The title (never null)

getGenre

public String getGenre()
Get the genre.

Specified by:
getGenre in class LTR
Returns:
The genre (never null)

getYear

public String getYear()
Get the year.

Specified by:
getYear in class LTR
Returns:
The year (never null)

getComment

public String getComment()
Get the comment.

Specified by:
getComment in class LTR
Returns:
The comment (never null)

getTrack

public String getTrack()
Get the track.

Specified by:
getTrack in class LTR
Returns:
The track (never null)

readAutoInt

protected int readAutoInt()
                   throws IOException
Read an ID3v2 integer. This is a 4 byte big endian value, which is only syncsafe for ID3v2.4 or higher, but not for ID3v2.3.

Returns:
The integer read.
Throws:
IOException - If there were not enough bytes in the file.

readFrame

protected net.shredzone.ifish.ltr.TagMp3v2.Frame readFrame()
                                                    throws IOException
Read a tag frame. A Frame object will be returned, or null if no more frames were available.

Returns:
The next frame, or null
Throws:
IOException - If premature EOF was reached.


Copyright © 2007-2011 shredzone.org. All Rights Reserved.