net.shredzone.ifish.ltr
Class LTR

java.lang.Object
  extended by net.shredzone.ifish.ltr.LTR
Direct Known Subclasses:
LTRmp3, TagAsf, TagOggVorbis

public abstract class LTR
extends Object

The Base Class for the Lightweight Tag Reader. LTR was made to read the basic tag information of MP3 (IDv1, IDv2), Ogg Vorbis and ASF/WMA files. It is lightweight because it is optimized for speed, and is only able to read the tag information, but unable to edit them.

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

Field Summary
protected  LTRFactory factory
           
protected  RandomAccessFile in
           
 
Constructor Summary
LTR(RandomAccessFile in, LTRFactory factory)
          Create a new LTR object.
 
Method Summary
abstract  String getAlbum()
          Get the album.
abstract  String getArtist()
          Get the artist.
abstract  String getComment()
          Get the comment.
abstract  String getGenre()
          Get the genre.
abstract  String getTitle()
          Get the title.
abstract  String getTrack()
          Get the track.
abstract  String getType()
          Get the type of this file.
abstract  String getYear()
          Get the year.
protected  String readStringLen(int length)
          Read a String of a certain length from the file.
protected  String readStringLen(int length, String charset)
          Read a String of a certain length from the file.
 String toString()
          Return a string representation of the LTR content.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

in

protected RandomAccessFile in

factory

protected LTRFactory factory
Constructor Detail

LTR

public LTR(RandomAccessFile in,
           LTRFactory factory)
    throws FormatDecodeException
Create a new LTR object. It is connected to the file to be decoded, by a RandomAccessFile. The cursor position will be changed during recognizing and decoding.

Parameters:
in - RandomAccessFile to be used
factory - Reference to the LTRFactory
Throws:
FormatDecodeException - Description of the Exception
Method Detail

getType

public abstract 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").

Returns:
The type

getArtist

public abstract String getArtist()
Get the artist.

Returns:
The artist (never null)

getAlbum

public abstract String getAlbum()
Get the album.

Returns:
The album (never null)

getTitle

public abstract String getTitle()
Get the title.

Returns:
The title (never null)

getGenre

public abstract String getGenre()
Get the genre.

Returns:
The genre (never null)

getYear

public abstract String getYear()
Get the year.

Returns:
The year (never null)

getComment

public abstract String getComment()
Get the comment.

Returns:
The comment (never null)

getTrack

public abstract String getTrack()
Get the track.

Returns:
The track (never null)

readStringLen

protected String readStringLen(int length)
                        throws IOException
Read a String of a certain length from the file. It will always use "ISO-8859-1" encoding!

Parameters:
length - Maximum number of bytes to read
Returns:
String that was read
Throws:
IOException - If EOF was already reached

readStringLen

protected String readStringLen(int length,
                               String charset)
                        throws IOException
Read a String of a certain length from the file. The length will not be exceeded. No null termination is required. Anyhow an IOException will be thrown if the EOF was reached before invocation.

Parameters:
length - Maximum number of bytes to read
charset - Charset to be used
Returns:
String that was read
Throws:
IOException - If EOF was already reached

toString

public String toString()
Return a string representation of the LTR content.

Overrides:
toString in class Object
Returns:
String representation


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