FileDocCategorySizeDatePackage
LanguageListReader.javaAPI DocJaudiotagger 2.0.41859Wed Mar 30 16:11:50 BST 2011org.jaudiotagger.audio.asf.io

LanguageListReader

public class LanguageListReader extends Object implements ChunkReader
Reads and interprets the "Language List Object" of ASF files.
author
Christian Laireiter

Fields Summary
private static final org.jaudiotagger.audio.asf.data.GUID[]
APPLYING
The GUID this reader {@linkplain #getApplyingIds() applies to}
Constructors Summary
Methods Summary
public booleancanFail()
{@inheritDoc}


          
       
        return false;
    
public org.jaudiotagger.audio.asf.data.GUID[]getApplyingIds()
{@inheritDoc}

        return APPLYING.clone();
    
public org.jaudiotagger.audio.asf.data.Chunkread(org.jaudiotagger.audio.asf.data.GUID guid, java.io.InputStream stream, long streamPosition)
{@inheritDoc}

        assert GUID.GUID_LANGUAGE_LIST.equals(guid);
        final BigInteger chunkLen = Utils.readBig64(stream);

        final int readUINT16 = Utils.readUINT16(stream);

        final LanguageList result = new LanguageList(streamPosition, chunkLen);
        for (int i = 0; i < readUINT16; i++) {
            final int langIdLen = (stream.read() & 0xFF);
            final String langId = Utils
                    .readFixedSizeUTF16Str(stream, langIdLen);
            // langIdLen = 2 bytes for each char and optionally one zero
            // termination character
            assert langId.length() == langIdLen / 2 - 1
                    || langId.length() == langIdLen / 2;
            result.addLanguage(langId);
        }

        return result;