FileDocCategorySizeDatePackage
TextEncoding.javaAPI Docjid3 0.464375Sun Feb 06 18:11:25 GMT 2005org.blinkenlights.jid3.io

TextEncoding

public class TextEncoding extends Object
Text encoding representation used in v2 frames.
author
paul

Fields Summary
private byte
m_byEncoding
public static final TextEncoding
ISO_8859_1
public static final TextEncoding
UNICODE
private static TextEncoding
s_oDefaultTextEncoding
Constructors Summary
private TextEncoding(byte byEncoding)

        m_byEncoding = byEncoding;
    
Methods Summary
public booleanequals(java.lang.Object oOther)

        if ((oOther == null) || (!(oOther instanceof TextEncoding)))
        {
            return false;
        }

        TextEncoding oOtherTextEncoding = (TextEncoding)oOther;

        return (m_byEncoding == oOtherTextEncoding.m_byEncoding);
    
public static org.blinkenlights.jid3.io.TextEncodinggetDefaultTextEncoding()
Get the default text encoding which will be used in v2 frames, when not specified.

return
the default text encoding used when not specified


                                 
       
    
        return s_oDefaultTextEncoding;
    
public java.lang.StringgetEncodingString()
Get the Java encoding string matching this text encoding.

return
the matching encoding string

        switch (m_byEncoding)
        {
            case (byte)0x00:
                return "ISO-8859-1";
            case (byte)0x01:
                return "Unicode";
            default:
                return null;    // can't happen because we control construction of this object
        }
    
public bytegetEncodingValue()
Get the byte value corresponding to this text encoding.

return
the corresponding byte value

        return m_byEncoding;
    
public static org.blinkenlights.jid3.io.TextEncodinggetTextEncoding(int iEncoding)
Get the text encoding object represented by a given integer value.

param
iEncoding the value corresponding to a given text encoding
return
the matching text encoding object
throws
ID3Exception if no matching encoding exists

        return getTextEncoding((byte)iEncoding);
    
public static org.blinkenlights.jid3.io.TextEncodinggetTextEncoding(byte byEncoding)
Get the text encoding object represented by a given byte value.

param
byEncoding the value corresponding to a given text encoding
return
the matching text encoding object
throws
ID3Exception if no matching encoding exists

        switch (byEncoding)
        {
            case (byte)0x00:
                return ISO_8859_1;
            case (byte)0x01:
                return UNICODE;
            default:
                throw new ID3Exception("Unknown text encoding value " + byEncoding + ".");
        }
    
public static voidsetDefaultTextEncoding(org.blinkenlights.jid3.io.TextEncoding oTextEncoding)
Set the default text encoding to be used in v2 frames, when not specified.

param
oTextEncoding the default text encoding to be used when not specified

        if (oTextEncoding == null)
        {
            throw new NullPointerException("Default text encoding cannot be null.");
        }
        s_oDefaultTextEncoding = oTextEncoding;