com.tffenterprises.music.tag
Class ID3Genres

java.lang.Object
  extended by com.tffenterprises.music.tag.ID3Genres

public abstract class ID3Genres
extends java.lang.Object

ID3Genres is an utility class that provides a two-way mapping between ID3v1 genres and their IDs. The same mapping is also useful for ID3v2.

Version:
1.0d1 $Date: 2002/10/11 00:57:29 $
Author:
Guillaume Lessard

Field Summary
private static java.util.Hashtable GENRE_INDICES
          The converse of the GENRE_STRINGS array, as a Hashtable to make searches quick.
private static java.lang.String GENRE_NONE
          A recommended string that means "no genre"
private static java.lang.String[] GENRE_STRINGS
          The significance of the genre byte values, as strings.
private static java.lang.String[] SORTED_GENRE_STRINGS
          A sorted array containing the genre strings.
 
Constructor Summary
ID3Genres()
           
 
Method Summary
static java.lang.String ByteToString(byte genre)
          Translate from the Genre byte to the Genre string.
static java.util.Enumeration Enumerate()
          Obtain an enumerator for the list of Genres.
static java.lang.String[] getSortedGenres()
          Returns a sorted array of genre strings.
static byte StringToByte(java.lang.String genre)
          Translate from the Genre string to the Genre byte.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

GENRE_NONE

private static final java.lang.String GENRE_NONE
A recommended string that means "no genre"

See Also:
Constant Field Values

GENRE_STRINGS

private static java.lang.String[] GENRE_STRINGS
The significance of the genre byte values, as strings.


GENRE_INDICES

private static java.util.Hashtable GENRE_INDICES
The converse of the GENRE_STRINGS array, as a Hashtable to make searches quick.


SORTED_GENRE_STRINGS

private static java.lang.String[] SORTED_GENRE_STRINGS
A sorted array containing the genre strings.

Constructor Detail

ID3Genres

public ID3Genres()
Method Detail

ByteToString

public static java.lang.String ByteToString(byte genre)
Translate from the Genre byte to the Genre string.

Parameters:
genre - the byte value of a genre.
Returns:
the string that corresponds to the name of this genre, or the "None" string if there is no such genre.

StringToByte

public static byte StringToByte(java.lang.String genre)
Translate from the Genre string to the Genre byte.

Parameters:
genre - the name of the genre as string.
Returns:
the byte that corresponds to the name of this genre, or -1 if there is no such genre.

Enumerate

public static java.util.Enumeration Enumerate()
Obtain an enumerator for the list of Genres.

Returns:
an enumerator for the list of Genres.

getSortedGenres

public static java.lang.String[] getSortedGenres()
Returns a sorted array of genre strings. This is primarily useful for constructing things like combo boxes for selecting genres in a GUI.

Returns:
a sorted array of genre strings.