FileDocCategorySizeDatePackage
LanguageList.javaAPI DocJaudiotagger 2.0.43311Wed Mar 30 16:11:50 BST 2011org.jaudiotagger.audio.asf.data

LanguageList

public class LanguageList extends Chunk
This structure represents the data of the ASF language object.
The language list is simply a listing of language codes which should comply to RFC-1766.
Consider: the index of a language is used by other entries in the ASF metadata.
author
Christian Laireiter

Fields Summary
private final List
languages
List of language codes, complying RFC-1766
Constructors Summary
public LanguageList()
Creates a new instance.


             
      
        super(GUID.GUID_LANGUAGE_LIST, 0, BigInteger.ZERO);
    
public LanguageList(long pos, BigInteger size)
Creates an instance.

param
pos position within the ASF file.
param
size size of the chunk

        super(GUID.GUID_LANGUAGE_LIST, pos, size);
    
Methods Summary
public voidaddLanguage(java.lang.String language)
This method adds a language.

param
language language code

        if (language.length() < MetadataDescriptor.MAX_LANG_INDEX) {
            if (!this.languages.contains(language)) {
                this.languages.add(language);
            }
        } else {
            throw new IllegalArgumentException(
                    ErrorMessage.WMA_LENGTH_OF_LANGUAGE_IS_TOO_LARGE
                            .getMsg(language.length() * 2 + 2));
        }
    
public java.lang.StringgetLanguage(int index)
Returns the language code at the specified index.

param
index the index of the language code to get.
return
the language code at given index.

        return this.languages.get(index);
    
public intgetLanguageCount()
Returns the amount of stored language codes.

return
number of stored language codes.

        return this.languages.size();
    
public java.util.ListgetLanguages()
Returns all language codes in list.

return
list of language codes.

        return new ArrayList<String>(this.languages);
    
public java.lang.StringprettyPrint(java.lang.String prefix)
{@inheritDoc}

        final StringBuilder result = new StringBuilder(super.prettyPrint(prefix));
        for (int i = 0; i < getLanguageCount(); i++) {
            result.append(prefix);
            result.append("  |-> ");
            result.append(i);
            result.append(" : ");
            result.append(getLanguage(i));
            result.append(Utils.LINE_SEPARATOR);
        }
        return result.toString();
    
public voidremoveLanguage(int index)
Removes the language entry at specified index.

param
index index of language to remove.

        this.languages.remove(index);