net.shredzone.ifish.ltr
Class LTRmp3

java.lang.Object
  extended by net.shredzone.ifish.ltr.LTR
      extended by net.shredzone.ifish.ltr.LTRmp3
Direct Known Subclasses:
TagMp3v1, TagMp3v2, TagMp3v200

public abstract class LTRmp3
extends LTR

The Base Class for mp3 decoding of the Lightweight Tag Reader.

Version:
$Id: LTRmp3.java 289 2009-04-28 21:21:46Z shred $

Field Summary
 
Fields inherited from class net.shredzone.ifish.ltr.LTR
factory, in
 
Constructor Summary
LTRmp3(RandomAccessFile in, LTRFactory factory)
          Constructor for the LTRmp3 object
 
Method Summary
protected  String decodeGenre(int id)
          Decode the mp3 numerical Genre code and convert it to a human readable string.
protected  int readInt()
          Read an ID3v2 integer.
protected  byte readSyncsafe()
          Read a syncsafe byte.
protected  int readSyncsafeInt()
          Read an ID3v2 syncsafe integer.
 
Methods inherited from class net.shredzone.ifish.ltr.LTR
getAlbum, getArtist, getComment, getGenre, getTitle, getTrack, getType, getYear, readStringLen, readStringLen, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LTRmp3

public LTRmp3(RandomAccessFile in,
              LTRFactory factory)
       throws FormatDecodeException
Constructor for the LTRmp3 object

Parameters:
in - File to be used
factory - Reference to the LTRFactory
Throws:
FormatDecodeException - Could not decode file
Method Detail

decodeGenre

protected String decodeGenre(int id)
Decode the mp3 numerical Genre code and convert it to a human readable string. The genre is decoded according to the specifications found at www.id3.org, as well as the WinAmp extensions.

Parameters:
id - Genre ID
Returns:
ID String, null if the genre ID was unknown

readInt

protected int readInt()
               throws IOException
Read an ID3v2 integer. This is a 4 byte big endian value, which is always not syncsafe.

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

readSyncsafeInt

protected int readSyncsafeInt()
                       throws IOException
Read an ID3v2 syncsafe integer. This is a 4 byte big endian value with the bit 7 of each byte always being 0.

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

readSyncsafe

protected byte readSyncsafe()
                     throws IOException
Read a syncsafe byte. It is made sure that a byte is available in the file, and that bit 7 is 0. An IOException is thrown otherwise.

Returns:
The byte read.
Throws:
IOException - If premature EOF was reached or byte was not syncsafe.


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