FileDocCategorySizeDatePackage
ID3v2DataMapping.javaAPI DocMyID3 for Android11201Wed Oct 08 18:11:42 BST 2008org.cmc.music.myid3

ID3v2DataMapping

public class ID3v2DataMapping extends Object implements MusicMetadataConstants

Fields Summary
private static final ID3v2TagHandler[]
handlers
private static final Map
keyToFrameTypeMap
private static final Vector
ignoredFrameTypes
Constructors Summary
Methods Summary
public org.cmc.music.common.ID3FrameTypegetID3FrameType(java.lang.Object key)

	
	
		for (int i = 0; i < handlers.length; i++)
		{
			ID3v2TagHandler handler = handlers[i];

			Object key = handler.getKey();
			if (key != null)
				keyToFrameTypeMap.put(key, handler.getFrameType());
			else
				ignoredFrameTypes.add(handler.getFrameType());
		}
	
		if (key.equals(KEY_PICTURES))
			return ID3FrameType.PICTURE;

		return (ID3FrameType) keyToFrameTypeMap.get(key);
	
public booleanisIgnoredID3FrameType(org.cmc.music.common.ID3FrameType frame_type)

		return ignoredFrameTypes.contains(frame_type);
	
private static booleanisNumber(java.lang.String s)

		boolean result = new RE("^-?[0-9]+$").match(s);

		return result;
	
public org.cmc.music.metadata.MusicMetadataprocess(java.util.Vector tags)

		if (tags == null)
			return null;

		try
		{
			MusicMetadata result = new MusicMetadata("id3v2");

			for (int i = 0; i < tags.size(); i++)
			{
				Object o = (Object) tags.get(i);
				if (o instanceof MyID3v2FrameImage)
				{
					MyID3v2FrameImage imageFrame = (MyID3v2FrameImage) o;

					ImageData imageData = imageFrame.getImageData();
					result.addPicture(imageData);

					continue;
				}
				if (!(o instanceof MyID3v2FrameText))
					continue;
				MyID3v2FrameText tag = (MyID3v2FrameText) tags.get(i);
				//					process(tag);
				process(result, tag);
			}

			return result;
		}
		catch (Throwable e)
		{


			return null;
		}
	
private voidprocess(org.cmc.music.metadata.MusicMetadata values, MyID3v2FrameText tag)



		for (int i = 0; i < handlers.length; i++)
		{
			ID3v2TagHandler handler = handlers[i];
			if (!handler.matches(tag.frame_id))
				continue;
			handler.process(values, tag);
			return;
		}